JavaScript animation engine
Fix timeline callbacks
Julian Garnier8fdff5a4f408
diff --git a/documentation/examples/anime-timeline.html b/documentation/examples/anime-timeline.htmlindex a51383b4..538e6e1f 100644--- a/documentation/examples/anime-timeline.html+++ b/documentation/examples/anime-timeline.html@@ -109,7 +109,8 @@},complete: function(anim) {console.log('tl complete');- }+ },+ autoplay: false});document.querySelector('.controls .play').onclick = tl.play;@@ -122,23 +123,31 @@scale: 8,background: '#FF1461',begin: function() { console.log('animation 1 began')},+ changeBegin: function() { console.log('animation 1 change began')},+ changeComplete: function() { console.log('animation 1 change completed')},complete: function() { console.log('animation 1 completed')}}).add({background: '#18FF92',rotate: 45,begin: function() { console.log('animation 2 began')},+ changeBegin: function() { console.log('animation 2 change began')},+ changeComplete: function() { console.log('animation 2 change completed')},complete: function() { console.log('animation 2 completed')}}).add({background: '#5A87FF',begin: function() { console.log('animation 3 began')},+ changeBegin: function() { console.log('animation 3 change began')},+ changeComplete: function() { console.log('animation 3 change completed')},complete: function() { console.log('animation 3 completed')}}).add({background: '#FBF38C',rotate: 90,begin: function() { console.log('animation 4 began')},+ changeBegin: function() { console.log('animation 4 change began')},+ changeComplete: function() { console.log('animation 4 change completed')},complete: function() { console.log('animation 4 completed')}}).add({@@ -146,6 +155,8 @@scaleY: .5,background: '#FBF38C',begin: function() { console.log('animation 5 began')},+ changeBegin: function() { console.log('animation 5 change began')},+ changeComplete: function() { console.log('animation 5 change completed')},complete: function() { console.log('animation 5 completed')}});diff --git a/src/index.js b/src/index.jsindex e03eebe5..b3b8d2dc 100644--- a/src/index.js+++ b/src/index.js@@ -993,7 +993,7 @@ function anime(params = {}) {const insTime = adjustTime(engineTime);const insReversed = instance.reversed;instance.currentTime = insTime;- if (!instance.began || !insDuration) {+ if (!instance.began) {instance.began = true;setCallback('begin');setCallback('loopBegin');@@ -1173,7 +1173,7 @@ function timeline(params = {}) {tl.pause();tl.duration = 0;tl.add = function(instanceParams, timelineOffset) {- function passThrough(ins) { ins.began = true; ins.completed = true; };+ function passThrough(ins) { ins.began = true; ins.completed = true; ins.changeCompleted = true; };tl.children.forEach(passThrough);let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));insParams.targets = insParams.targets || params.targets;