JavaScript animation engine
Add TL promise in doc
Julian Garnierf74b42a71636
diff --git a/documentation/examples/anime-timeline.html b/documentation/examples/anime-timeline.htmlindex 67f0b01b..91fc7246 100644--- a/documentation/examples/anime-timeline.html+++ b/documentation/examples/anime-timeline.html@@ -104,6 +104,7 @@<div class="buttons"><button class="play">Play</button><button class="pause">Pause</button>+ <button class="reverse">Reverse</button><button class="restart">Restart</button></div><div class="timeline">@@ -129,22 +130,27 @@update: function(anim) {controlsProgressEl.value = anim.progress;},- loopComplete: (a) => console.log('END'),+ loopComplete: (a) => console.log('TL loop completed'),autoplay: true,- loop: true,- // direction: 'alternate',easing: 'easeOutQuad'});document.querySelector('.controls .play').onclick = tl.play;document.querySelector('.controls .pause').onclick = tl.pause;+ document.querySelector('.controls .reverse').onclick = tl.reverse;document.querySelector('.controls .restart').onclick = tl.restart;tl.add({translateY: -100,scale: 8,- background: '#FF1461'+ background: '#FF1461',+ begin: function() {+ console.log('first began')+ },+ complete: function() {+ console.log('first completed')+ }}).add({background: '#18FF92',@@ -161,6 +167,12 @@scaleX: 3,scaleY: .5,background: '#FBF38C',+ begin: function() {+ console.log('last began')+ },+ complete: function() {+ console.log('last completed')+ }}, '-=400');controlsProgressEl.addEventListener('input', function() {diff --git a/documentation/index.html b/documentation/index.htmlindex 0e26268f..b1386b40 100644--- a/documentation/index.html+++ b/documentation/index.html@@ -3137,8 +3137,9 @@ anime({<div class="circle el"></div></div><script>var finishedPromise = function() {-if (window.demoPromiseResetTimeout) clearTimeout(window.demoPromiseResetTimeout);+// if (window.demoPromiseResetTimeout) clearTimeout(window.demoPromiseResetTimeout);anime.set('.promise-demo .el', {backgroundColor: ''});+anime.set('.promise-demo .finished-log', {value: ''});/*DEMO*/var progressLogEl = document.querySelector('.promise-demo .progress-log');var promiseEl = document.querySelector('.promise-demo .el');@@ -3149,20 +3150,26 @@ function logFinished() {finishedLogEl.value = 'Promise resolved';anime.set(promiseEl, {backgroundColor: '#18FF92'});// Rebind the promise, since this demo can be looped.- window.demoPromiseResetTimeout = setTimeout(function() {- promise = animation.finished.then(logFinished);- });+ // window.demoPromiseResetTimeout = setTimeout(function() {+ // promise = animation.finished.then(logFinished);+ // });}-var animation = anime({+var animation = anime.timeline({targets: promiseEl,- translateX: 250,- delay: 1000,- endDelay: 1000,+ delay: 400,+ duration: 500,+ endDelay: 400,+ easing: 'easeInOutSine',update: function(anim) {progressLogEl.value = 'progress : '+Math.round(anim.progress)+'%';- if (!anim.completed) finishedLogEl.value = 'Promise not resolved';}+}).add({+ translateX: 250+}).add({+ scale: 2+}).add({+ translateX: 0});var promise = animation.finished.then(logFinished);