mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-24 15:16:07 +09:00
スライドショーをランダムに
This commit is contained in:
parent
c1a455a3ed
commit
eb34ab6bd1
@ -100,14 +100,12 @@
|
||||
|
||||
this.change = () => {
|
||||
if (this.images.length == 0) return;
|
||||
if (this.index >= this.images.length) this.index = 0;
|
||||
|
||||
const img = `url(${ this.images[this.index].url }?thumbnail&size=1024)`;
|
||||
const index = Math.floor(Math.random() * this.images.length);
|
||||
const img = `url(${ this.images[index].url }?thumbnail&size=1024)`;
|
||||
|
||||
this.refs.slideB.style.backgroundImage = img;
|
||||
|
||||
this.index++;
|
||||
|
||||
anime({
|
||||
targets: this.refs.slideB,
|
||||
opacity: 1,
|
||||
@ -136,8 +134,7 @@
|
||||
}).then(images => {
|
||||
this.update({
|
||||
fetching: false,
|
||||
images: images,
|
||||
index: 0
|
||||
images: images
|
||||
});
|
||||
this.refs.slideA.style.backgroundImage = '';
|
||||
this.refs.slideB.style.backgroundImage = '';
|
||||
|
Loading…
Reference in New Issue
Block a user