Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Fix timeline wrong begin() call

Julian Garnier1dcc7e18801c
diff --git a/anime.js b/anime.js
index 71a693f7..1adc6a93 100644
--- a/anime.js
+++ b/anime.js
@@ -916,7 +916,7 @@
instance.began = true;
setCallback('begin');
}
- (insTime <= instance.endDelay) setCallback('run');
+ if (insTime <= instance.endDelay) setCallback('run');
}
if (insTime > insDelay && insTime < insDuration) {
setAnimationsProgress(insTime);
@@ -1061,7 +1061,6 @@
tl.pause();
tl.duration = 0;
tl.add = function(instanceParams, timelineOffset) {
- const currentTime = tl.currentTime;
function passThrough(ins) { ins.began = true; ins.completed = true; };
tl.children.forEach(passThrough);
let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
@@ -1078,9 +1077,9 @@
if (is.fnc(tl.delay)) tl.delay = ins.delay;
if (is.fnc(tlDuration) || totalDuration > tlDuration) tl.duration = totalDuration;
tl.children.push(ins);
+ tl.seek(0);
tl.reset();
- tl.seek(currentTime);
- if (tl.autoplay) tl.play();
+ if (tl.autoplay) tl.restart();
return tl;
}
return tl;
diff --git a/documentation/examples/anime-timeline-stresstest.html b/documentation/examples/anime-timeline-stresstest.html
index efbc9615..f947f768 100644
--- a/documentation/examples/anime-timeline-stresstest.html
+++ b/documentation/examples/anime-timeline-stresstest.html
@@ -41,6 +41,7 @@
height: 10px;
background: #FFF;
margin: 10px;
+ border-radius: 50%;
}
.controls {
@@ -119,7 +120,7 @@
el.style.backgroundColor = 'hsl(' + hue + ', 60%, 60%)';
tl.add({
targets: el,
- scale: [0, 3],
+ scale: [0, 2],
duration: 5000,
easing: 'easeOutElastic(1, .05)',
}, !i ? 0 : '-=4990');