html structure draft and first try of js time laps
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
var fps = 2, now, then = Date.now(), interval = 1000/fps, delta;
|
||||
|
||||
function init(){
|
||||
console.log("Init");
|
||||
// preload all pictures before launching
|
||||
|
||||
setTimeout(function(){
|
||||
play();
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
function play(millis){
|
||||
requestAnimationFrame(play);
|
||||
|
||||
now = Date.now();
|
||||
delta = now - then;
|
||||
|
||||
if(delta > interval){
|
||||
$(".frame.current", "#pictures").toggleClass('current').next().toggleClass('current');
|
||||
|
||||
then = now -(delta % interval);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
init();
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user