thanhlong203 / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

updateStyle called after FINISH event #299

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an instance of a PredefinedEffect subclass
2. Add a FINISH listener
3. Play the animation.

What is the expected output? What do you see instead?
I expect the FINISH handler to be called after the animation has completed 
(i.e. the last call of updateStyle). However, updateStyle is called once more 
after the FINISH event is dispatched.

What version of the product are you using? On what operating system?
Head (r810) on any OS

Please provide any additional information below.

It happens because PredefinedEffect's onEnd method calls updateStyle().  Since 
Animation.prototype.cycle is calling onEnd() after onFinish(), it means that 
there will be one additional update after the animation has ended. 

This is a big problem if you try to set the property you're animating in the 
FINISH handler, as your set value will just be overridden in the next update. 

The issue can be worked around by 1) setting the animation's updateStyle to 
goog.nullFunction in the FINISH handler or 2) adding an END listener in the 
FINISH handler and setting the property in that. 
Neither of these seems like a very good solution.

Original issue reported on code.google.com by matthewt...@gmail.com on 29 Mar 2011 at 2:44