UNPKG

animation-stepper

Version:

Javascript library to handle several animations at once using a singleton approach. One window.requestAnimationFrame instance will be running in the background to orchest all animations.

41 lines (32 loc) 980 B
// ---------------------------------------------------------------------- // myStuff.js // ---------------------------------------------------------------------- AS.init(); function start() { //animationStartTime = window.performance.now(); //requestId = window.requestAnimationFrame(animate); AS.startByName("Animation-1"); } function stop() { //if (requestId) window.cancelAnimationFrame(requestId); //requestId = 0; AS.stopByName("Animation-1"); } function stopByLabel() { //if (requestId) window.cancelAnimationFrame(requestId); //requestId = 0; AS.stopByLabel("clouds"); } function pause() { //if (requestId) window.cancelAnimationFrame(requestId); //requestId = 0; AS.pauseByName("Animation-1"); } function gotoStep() { //if (requestId) window.cancelAnimationFrame(requestId); //requestId = 0; AS.goToStepByName("Animation-1", 3); } function resetByLabel( lbl ) { AS.resetAnimationByLabel('yellow'); }