Skip to content

Commit

Permalink
fix remove example
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangarnier committed Jul 4, 2016
1 parent 240c205 commit 4b4275d
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions examples/remove-elements-from-animations.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
div {
width: 1.5rem;
height: 1.5rem;
}

div.disabled {
background: #FFF;
}

Expand All @@ -34,36 +37,25 @@
<script src="../anime.js"></script>
<script>

// var animation = anime({
// targets: 'div',
// translateX: function() { return anime.random(-6, 6) + 'rem'; },
// translateY: function() { return anime.random(-6, 6) + 'rem'; },
// scale: function() { return anime.random(10, 20) / 10; },
// rotate: function() { return anime.random(-360, 360); },
// delay: function() { return 400 + anime.random(0, 500); },
// duration: function() { return anime.random(1000, 2000); },
// direction: 'alternate',
// loop: true
// });

var loop = anime({
duration: 100,
update: function(anim) {
// console.log(anim.progress);
}
var animation = anime({
targets: 'div',
translateX: function() { return anime.random(-6, 6) + 'rem'; },
translateY: function() { return anime.random(-6, 6) + 'rem'; },
scale: function() { return anime.random(10, 20) / 10; },
rotate: function() { return anime.random(-360, 360); },
delay: function() { return 400 + anime.random(0, 500); },
duration: function() { return anime.random(1000, 2000); },
direction: 'alternate',
loop: true
});

document.onmousemove = function(e) {
if (e.target.matches('div')) {
anime.remove(e.target);
e.target.classList.add('disabled');
}
}

document.onclick = function(e) {
animation.restart();
console.log(anime.list);
}

</script>
</body>
</html>

0 comments on commit 4b4275d

Please sign in to comment.