Skip to content

Commit

Permalink
fix an animation glitch
Browse files Browse the repository at this point in the history
If a push led to a fall, the fall could join before the fall animation
completed.
  • Loading branch information
evmar committed Feb 26, 2013
1 parent 02fdb53 commit 03458f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion jelly.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ class Stage
names = ['transitionend', 'webkitTransitionEnd']
end = () =>
@dom.removeEventListener(name, end) for name in names
cb()
# Wait one call stack before continuing. This is necessary if there
# are multiple pending end transition events (multiple jellies moving);
# we want to wait for them all here and not accidentally catch them
# in a subsequent waitForAnimation.
setTimeout(cb, 0)
@dom.addEventListener(name, end) for name in names
return

Expand Down
2 changes: 1 addition & 1 deletion jelly.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
name = names[_i];
_this.dom.removeEventListener(name, end);
}
return cb();
return setTimeout(cb, 0);
};
for (_i = 0, _len = names.length; _i < _len; _i++) {
name = names[_i];
Expand Down

0 comments on commit 03458f5

Please sign in to comment.