Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Add endDelay property #254

Julian Garnierfbd17b896623
diff --git a/anime.js b/anime.js
index 474c0ce3..94a8bdc9 100644
--- a/anime.js
+++ b/anime.js
@@ -38,6 +38,7 @@
const defaultTweenSettings = {
duration: 1000,
delay: 0,
+ endDelay: 0,
easing: 'easeOutElastic',
elasticity: 500,
round: 0
@@ -600,7 +601,7 @@
tween.from = decomposeValue(from, unit);
tween.to = decomposeValue(to, unit);
tween.start = previousTween ? previousTween.end : prop.offset;
- tween.end = tween.start + tween.delay + tween.duration;
+ tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;
tween.easing = normalizeEasing(tween.easing);
tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;
tween.isPath = is.pth(tweenValue);
diff --git a/documentation/examples/anime-tests.html b/documentation/examples/anime-tests.html
index de33938e..91d3dec5 100644
--- a/documentation/examples/anime-tests.html
+++ b/documentation/examples/anime-tests.html
@@ -37,27 +37,22 @@
</style>
</head>
<body>
- <div class="item duration-0 color-01"></div>
- <div class="item seek-0 color-04"></div>
+ <div class="item color-01"></div>
+ <div class="item color-02"></div>
+ <div class="item color-03"></div>
<script>
- anime({
- targets: '.duration-0',
+ var animation = anime({
+ targets: '.item',
translateX: 100,
- duration: 0,
- begin: function() {console.log('duration-0 begin') },
- update: function() {console.log('duration-0 update') },
- complete: function() {console.log('duration-0 complte') }
- });
- var seek0 = anime({
- targets: '.seek-0',
- translateX: [100, 0],
- autoplay: false,
- begin: function() {console.log('seek-0 begin') },
- update: function() {console.log('seek-0 update') },
- complete: function() {console.log('seek-0 complte') }
+ endDelay: function(el, i, t) { return (t - i) * 1000; },
+ easing: 'linear',
+ direction: 'reverse',
+ complete: function() {
+ console.log('complete');
+ }
});
- seek0.seek(0);
+ console.log(animation.animations);
</script>
</body>
</html>
\ No newline at end of file