You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import TransformEffects from './TransformEffects.jsx';
|
|
|
|
class Slideshow{
|
|
|
|
//--------------------------
|
|
// constructor
|
|
//--------------------------
|
|
constructor(slides)
|
|
{
|
|
this.slides = slides;
|
|
var timer = null;
|
|
this.slideIndex = 0;
|
|
for(let i of slides)
|
|
{
|
|
new TransformEffects().rotateY(i, 0, 90, "top right");
|
|
i.style.opacity = 1;
|
|
}
|
|
|
|
this.start();
|
|
}
|
|
|
|
//--------------------------
|
|
// methods
|
|
//--------------------------
|
|
start()
|
|
{
|
|
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right");
|
|
this.startTimer()
|
|
}
|
|
|
|
startTimer()
|
|
{
|
|
var self = this;
|
|
this.timer = setTimeout(f=>
|
|
{
|
|
self.slideTranstion();
|
|
}, 4000);
|
|
}
|
|
|
|
slideTranstion()
|
|
{
|
|
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 90, "top right");
|
|
++this.slideIndex;
|
|
if(this.slideIndex > this.slides.length-1)
|
|
this.slideIndex = 0;
|
|
new TransformEffects().rotateY(this.slides[this.slideIndex], 1, 0, "top right");
|
|
this.startTimer();
|
|
}
|
|
|
|
setDisplayType()
|
|
{
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
// eventhandlers
|
|
//--------------------------
|
|
}
|
|
export {Slideshow as default}
|