PolymerElements / neon-animation

Polymer + Web Animations
https://www.webcomponents.org/element/PolymerElements/neon-animation
143 stars 98 forks source link

Polymer.NeonAnimationRunnerBehavior.cancelAnimation does not cancel animations #215

Open dmitriyilin opened 7 years ago

dmitriyilin commented 7 years ago

Description

Polymer.NeonAnimationRunnerBehavior.cancelAnimation does not cancel currently active animations

Please refer to the code snippet from the 2.0-preview branch:

/**
 * Plays an animation with an optional `type`.
 * @param {string=} type
 * @param {!Object=} cookie
 */
playAnimation: function(type, cookie) {
  var configs = this.getAnimationConfig(type);
  if (!configs) {
    return;
  }
  this._active = this._active || {};
  if (this._active[type]) {

...

/**
 * Cancels the currently running animations.
 */
cancelAnimation: function() {
  for (var k in this._animations) {
    this._animations[k].cancel();
  }
  this._animations = {};
}

The reason may be that due to some changes _animations is gone now. Therefore, _active should be used to cancel animations.