forked from projects/fipamo
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}
|