Skip to content

Commit

Permalink
Add class "bug-dead" on die and remove on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ptuchik committed Oct 7, 2018
1 parent 4ae4b3a commit d4ed206
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bug.js
Expand Up @@ -466,6 +466,7 @@ var Bug = {
this.bug.style.bottom = '';
this.bug.style.top = 0;
this.bug.style.left = 0;
this.bug.classList.remove('bug-dead');
},

animate: function(t) {
Expand Down Expand Up @@ -860,6 +861,8 @@ var Bug = {
rotationRate = this.random(0, 20, true),
startTime = Date.now(),
that = this;

this.bug.classList.add('bug-dead');

this.dropTimer = requestAnimFrame(function(t) {
that._lastTimestamp = t;
Expand Down Expand Up @@ -1034,4 +1037,4 @@ window.requestAnimFrame = (function() {
window.msRequestAnimationFrame || function( /* function */ callback, /* DOMElement */ element) {
window.setTimeout(callback, 1000 / 60);
};
})();
})();

0 comments on commit d4ed206

Please sign in to comment.