CreateJS / TweenJS

A simple but powerful tweening / animation library for Javascript. Part of the CreateJS suite of libraries.
http://createjs.com/
MIT License
3.56k stars 967 forks source link

Suggestion: public timeline.getTweens() to safely access timeline._tweens. #88

Closed SmartArtsStudio closed 7 years ago

SmartArtsStudio commented 8 years ago

Suggestion:

// to safely access timeline._tweens, a public:
timeline.tweens
// or 
timeline.getTweens()

I realise accessing the timeline._tweens array is for very advanced use. In my case I am iterating through timeline._tweens to find and re-instantiate tween.target.state.t instances within tweens exported from Flash/Animate... Why the heck would anyone ever need to do that?!! :)

I have ported the latest Box2D( including liquidFun ), created a wrapper library "addPhysicsJS", and an built most of an extension for Flash/Animate which all combined. Enable designers to export physics entity coded levels directly from the IDE to the browser. Powered by CreateJS. Watch this space https://github.com/SmartArtsStudio/addPhysicsJS...

Obviously a layer in the IDE timeline is exported as a Tween instance. If a designer places their game levels each in their own frame on the timeline, each level symbol needs the ability to be "reset" if desired upon gotoAndPlay( specificLevel ).

TweenJS notes that it made an improvement on the Flash runtime in that instances are not automatically re-instantiated when a frame is re-entered... in order to add that functionality back in I access timeline._tweens and why I believe timeline.getTweens() would be a practical addition to the API, for building really cool things on top of CreateJS.

gskinner commented 7 years ago

Interesting use case. I've renamed it to .tweens and docced it appropriately.

Note that it also required an update to MovieClip in EaselJS.