Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Precent run() callback to be triggered after endDelay

Julian Garnier0163c961622f
diff --git a/anime.js b/anime.js
index 6eb9abdf..71a693f7 100644
--- a/anime.js
+++ b/anime.js
@@ -801,7 +801,6 @@
function anime(params = {}) {
let startTime = 0, lastTime = 0, now = 0;
- let lastStartTime = 0;
let children, childrenLength = 0;
let resolve = null;
@@ -917,7 +916,7 @@
instance.began = true;
setCallback('begin');
}
- setCallback('run');
+ (insTime <= instance.endDelay) setCallback('run');
}
if (insTime > insDelay && insTime < insDuration) {
setAnimationsProgress(insTime);
@@ -928,7 +927,6 @@
}
if ((insTime >= insDuration && instance.currentTime !== insDuration) || !insDuration) {
setAnimationsProgress(insDuration);
- lastStartTime = startTime;
if (!instance.reversed) countIteration();
}
}
diff --git a/documentation/examples/anime-states.html b/documentation/examples/anime-states.html
index 15c604e5..1bd954d4 100644
--- a/documentation/examples/anime-states.html
+++ b/documentation/examples/anime-states.html
@@ -38,12 +38,13 @@
</head>
<body>
<div class="item color-01"></div>
- <div class="item color-02"></div>
+ <div class="item color-01"></div>
+ <div class="item color-03"></div>
<div class="item color-03"></div>
<script>
var animation = anime({
- targets: '.item',
+ targets: '.color-01',
translateX: 0,
translateY: 0,
scale: 1,
@@ -51,7 +52,7 @@
easing: 'easeOutExpo',
autoplay: false,
update: function() {
- console.log('updating')
+ console.log('animation updating')
}
})
@@ -73,6 +74,15 @@
translateY: 100
}
+ var timeline = anime.timeline({
+ targets: '.color-03',
+ easing: 'easeOutExpo',
+ autoplay: false,
+ update: function() {
+ console.log('timeline updating')
+ }
+ })
+
</script>
</body>
</html>
\ No newline at end of file