mootools/mootools-core — Issue #2207: Fx.cancel() should clear animation so Fx.resume() will not continue it
Author: ibolmo
Created: 2012-01-19 07:00:46+00:00
State: open
Labels: bug, semantic

(from [Lighthouse](https://mootools.lighthouseapp.com/projects/2706/tickets/713-fxcancel-should-clear-animation-so-fxresume-will-not-continue-it))

When Fx.resume() is called after Fx.cancel(), the animation is resumed as if it were paused, rather than cancelled.

Really simple test case:

$('test').set('tween', {duration: 2000}).tween('width', 100);
$('test').get('tween').cancel();
$('test').get('tween').resume();
The animation should be cancelled almost immediately, but in fact it continues and finishes.

----

(from a [follow-up](https://mootools.lighthouseapp.com/projects/2706/tickets/713-fxcancel-should-clear-animation-so-fxresume-will-not-continue-it#ticket-713-3))

Correct, the element shouldn't be returned to its starting position. What I mean is that the animation starts, then is stopped via Fx.cancel(), which is all well and good. Then if Fx.resume() is called after, the animation actually continues and completes itself.
Surely Fx.cancel() should stop the animation and clear it so it can't be resumed, otherwise Fx.pause() and Fx.cancel() serve the same purpose, the only difference being the onCancel event being fired? If this is the intended functionality, I think this should be made clear in the docs as the function names would imply otherwise.
$('test').set('tween', {duration: 2000}).tween('width', 100);
(function(){
$('test').get('tween').cancel();
$('test').get('tween').resume();
}).delay(1000);
Expected functionality: Animation stops half-way through
Actual functionality: Animation pauses half-way through then is resumed and completes