Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Revert "Improve remove()"

Julian Garnier86704306fba5
diff --git a/anime.js b/anime.js
index 8258fdbd..a126603f 100644
--- a/anime.js
+++ b/anime.js
@@ -665,22 +665,18 @@
const animations = instance.animations;
for (let a = animations.length; a--;) {
const animation = animations[a];
- const prop = propertyName ? (animation.property === propertyName) : true;
- console.log(propertyName, (animation.property === propertyName));
- if (prop && instance.animatables.some(t => t.target === target)) {
- console.log('hai');
- animations.splice(a, 1);
- if (!animations.length) instance.pause();
- }
+ if ((propertyName && (animation.property === propertyName)) && instance.animatables.some(t => t.target === target)) {
+ animations.splice(a, 1);
+ if (!animations.length) instance.pause();
+ }
}
}
}
- function removeTargets(targets, propertyName) {
+ function removeTargets(targets) {
const targetsArray = parseTargets(targets);
- for (let i = targetsArray.length; i--;) {
- console.log(targetsArray[i]);
- removeAnimation(targetsArray[i], propertyName);
+ for (let i = targets.length; i--;) {
+ removeAnimation(targets[i]);
}
}
diff --git a/documentation/examples/anime-tests.html b/documentation/examples/anime-tests.html
index 7be53013..65425300 100644
--- a/documentation/examples/anime-tests.html
+++ b/documentation/examples/anime-tests.html
@@ -41,26 +41,21 @@
<div class="item color-02"></div>
<div class="item color-03"></div>
<script>
- anime({
+ var anim = anime({
targets: '.color-01',
backgroundColor: '#BAD',
direction: 'alternate',
easing: 'linear',
- // translateX: 50,
+ translateX: 50,
loop: true
});
- anime({
+ var anim = anime({
targets: '.color-02',
scale: 2,
opacity: .5,
loop: true
});
- anime({
- targets: '.color-03',
- scale: 2,
- opacity: .5,
- loop: true
- });
+ console.log(anim);
function mouseenter(e) {
var anim = anime({
targets: this,
@@ -76,9 +71,9 @@
opacity: 1
})
}
- var el01 = document.querySelector('.color-01');
- el01.addEventListener('mouseenter', mouseenter, false);
- el01.addEventListener('mouseleave', mouseleave, false);
+ var el = document.querySelector('.color-01');
+ el.addEventListener('mouseenter', mouseenter, false);
+ el.addEventListener('mouseleave', mouseleave, false);
</script>
</body>
</html>
\ No newline at end of file