Applique tous les styles visuels
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nec purus ante. Maecenas a dui bibendum enim tincidunt bibendum. Aenean fermentum, nunc ac dignissim efficitur, lorem arcu eleifend mauris, ac accumsan leo arcu eget lorem. Proin nec elementum libero.
Vivamus tempus neque a tellus euismod volutpat. Quisque efficitur mauris urna. Suspendisse mollis facilisis convallis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nec purus ante. Maecenas a dui bibendum enim tincidunt bibendum. Aenean fermentum, nunc ac dignissim efficitur, lorem arcu eleifend mauris, ac accumsan leo arcu eget lorem. Proin nec elementum libero.
Vivamus tempus neque a tellus euismod volutpat. Quisque efficitur mauris urna. Suspendisse mollis facilisis convallis.
Le but est d'atteindre les 60 FPS (images par seconde)
Soit ~16.6ms entre chaque image
function draw() { requestAnimationFrame(draw); // Drawing code goes here } requestAnimationFrame(draw);
var latestKnownScrollY = 0; function onScroll() { latestKnownScrollY = window.scrollY; } function update() { requestAnimationFrame(update); var currentScrollY = latestKnownScrollY; // Drawing code goes here } requestAnimationFrame(update); window.addEventListener('scroll', onScroll, false);
Est soumis à l'Event Loop car dans la Main Thread
element.animate([ {transform: 'translate(200px, -100%)'}, {transform: 'translate(200px, ' + window.innerHeight + 'px)'} ], { duration: 1500, iterations: 10, delay: 300 });
Controller l'animation !
var animation = element.animate({transform: 'translateX(300px)'}, 1000); animation.play(); animation.pause(); animation.currentTime = 500; animation.playbackRate = 0.5; animation.reverse();
Freelance Front-end
React.js • Mobile First • Hybrid & Progressive Web Apps