tangled
alpha
login
or
join now
tokono.ma
/
diffuse
5
fork
atom
A music player that connects to your cloud/distributed storage.
5
fork
atom
overview
issues
4
pulls
pipelines
chore: improve artwork transition
Steven Vandevelde
3 months ago
658050f7
5591b307
+9
-5
1 changed file
expand all
collapse all
unified
split
src
themes
blur
artwork-controller
element.js
+9
-5
src/themes/blur/artwork-controller/element.js
···
51
51
// SIGNALS
52
52
53
53
#artwork = signal(
54
54
-
/** @type {{ current: (Artwork & { hash: string; loaded: boolean; url: string }) | null; previous: (Artwork & { hash: string; loaded: boolean; url: string }) | null }} */ ({
54
54
+
/** @type {{ current: (Artwork & { hash: string; index: number; loaded: boolean; url: string }) | null; previous: (Artwork & { hash: string; index: number; loaded: boolean; url: string }) | null }} */ ({
55
55
current: null,
56
56
previous: null,
57
57
}),
···
224
224
? { ...currArtwork.current, loaded: false }
225
225
: null,
226
226
current: art
227
227
-
? { ...art, hash: xxh32r(art.bytes).toString(), loaded: false, url }
227
227
+
? {
228
228
+
...art,
229
229
+
hash: xxh32r(art.bytes).toString(),
230
230
+
index: (currArtwork.current?.index ?? 0) + 1,
231
231
+
loaded: false,
232
232
+
url,
233
233
+
}
228
234
: null,
229
235
});
230
236
···
292
298
293
299
const hash = event.target.getAttribute("data-hash");
294
300
if (!hash) return;
295
295
-
296
296
-
// console.log("loaded", hash);
297
301
298
302
if (hash !== this.#artwork.value.current?.hash) return;
299
303
if (this.#artwork.value.current?.loaded) return;
···
378
382
this.#artwork.value.current,
379
383
].sort((a, b) => {
380
384
if (!a || !b) return 0;
381
381
-
return a.hash.localeCompare(b.hash);
385
385
+
return a.index % 2 ? 1 : -1;
382
386
});
383
387
384
388
const artwork = artworkArr.map((art) => {