mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-14 11:33:41 +02:00
wip(22w7g): add forceBg to glitch
This commit is contained in:
parent
173007ba71
commit
dc3f512121
7 changed files with 28 additions and 10 deletions
|
@ -26,7 +26,18 @@ body {
|
||||||
background-color: rgba(var(--color-base), .7);
|
background-color: rgba(var(--color-base), .7);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-blend-mode: overlay;
|
background-blend-mode: overlay;
|
||||||
background-position: fixed;
|
background-position: center;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow-y: scroll;
|
||||||
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
picture {
|
picture {
|
||||||
|
@ -155,7 +166,7 @@ body > div {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-aspect-ratio: 14/9) and (min-height: 450px) {
|
@media (min-aspect-ratio: 14/9) and (min-height: 600px) {
|
||||||
body {
|
body {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Generator {
|
||||||
_image: null,
|
_image: null,
|
||||||
_dir: location,
|
_dir: location,
|
||||||
_dir_rel: "assets/media/b64/",
|
_dir_rel: "assets/media/b64/",
|
||||||
count: 3,
|
count: 4,
|
||||||
// Get or set current background
|
// Get or set current background
|
||||||
get current () { return this._image; },
|
get current () { return this._image; },
|
||||||
set current (image) {
|
set current (image) {
|
||||||
|
|
|
@ -16,10 +16,6 @@ class GlitchWorker extends Generator {
|
||||||
self.postMessage("READY");
|
self.postMessage("READY");
|
||||||
}
|
}
|
||||||
|
|
||||||
test() {
|
|
||||||
console.log("yes");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run a scoped function on a random interval between
|
// Run a scoped function on a random interval between
|
||||||
queue(func) {
|
queue(func) {
|
||||||
clearTimeout(this._timers[func]);
|
clearTimeout(this._timers[func]);
|
||||||
|
@ -29,6 +25,16 @@ class GlitchWorker extends Generator {
|
||||||
this[func]?.();
|
this[func]?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set background by id and stop randBg animation
|
||||||
|
async forceBg(id) {
|
||||||
|
clearTimeout(this._timers.randBg);
|
||||||
|
|
||||||
|
const image = await this.fetchBg(id);
|
||||||
|
this.bg.current = image;
|
||||||
|
|
||||||
|
this.setBg(image);
|
||||||
|
}
|
||||||
|
|
||||||
// Event handler for messages from parent thread
|
// Event handler for messages from parent thread
|
||||||
message(event) {
|
message(event) {
|
||||||
const data = typeof event.data === "object" ? event.data : [event.data];
|
const data = typeof event.data === "object" ? event.data : [event.data];
|
||||||
|
|
2
public/assets/media/b64/1.txt
Executable file → Normal file
2
public/assets/media/b64/1.txt
Executable file → Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/assets/media/b64/4.txt
Normal file
1
public/assets/media/b64/4.txt
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue