Imagine I have a character MovieClip (loaded from a SWF) with an idle and walk animation.
Each limb is controlled by motion animation on the timeline.
With a simple gotoAndPlay I jump from one animation loop to the next.
The problem with this is there is a noticable jump between loops.
I’d like to smoothly transition from one cycle to another.
In practical terms, this means stopping (deactivating) the timeline animation, sampling each limb’s transforms from the destination frame, initializing tweens for each limb using Actuate, and on completion reactivating the timeline animation and playing it as normal.
I haven’t tested this yet with OpenFl yet, but I know from past experience in Flash that this wasn’t possible.
If I remember correctly, when an object was animated by a timeline it implemented a sort of lock. So if I tried running arm.x += 100 during an animation, x would revert to its timeline value before the next rendering phase.
In simpler terms, is there a way to influence a DisplayObject with code and timeline consecutively? Besides using trickery like nesting each limb, or temporarily using a stand-in Character movieclip for the transitions.
Or in other words - Is there a property or method in the API for toggling the influence of the timeline? If not, is there a hacky way to do it with reflection?
I know there’s DragonBones and other animation libraries that deal with this issue effectively, but I want to see if it’s possible in OpenFl.
How would another library handle this? By putting all the animation in code?
Sorry for the delay!
I’ve since tried using actuate tweens on a stopped timeline animation before returning to the original timeline animation, and it worked perfectly without issue.
It’s interesting to note however that Flash behaves differently to OpenFl in this respect, as I mentioned in the original post (but remembered it slightly wrong).
In Flash, if you run code that changes any property of the transform of an animated object, whether it’s playing or stopped, Flash effectively puts this object on the naughty step FOREVER, it just gets completely frozen out of the timeline animation.
The only way to make that object obey the timeline again is by gotoandstopping to a blank keyframe where the object is destroyed and gotoandstopping back to a frame where the object exists to create a new one.
Alternatively, destroying the entire movieclip that it’s a child of and creating a new one would also fix this.
Perhaps you could shed some light here as to why Flash and non-Flash targeted OpenFl apps behave differently in this respect?
In Flash it seems transform manipulation through code trumps timeline, but in OpenFl it’s the other way round (which is much more to my preference I should clarify).
Hmm – that’s an interesting observation! I didn’t know exactly how Flash timeline + actionscript changes interacted with each other.
I suppose it does kind of make sense to exclude an object from the timeline if you begin manipulating it but I want to find more ways we can leverage timeline animation and make it easier to control