Open richardeakin opened 8 years ago
To achieve your goal, wouldn't we need to separate the concerns of creation of animations from their scheduling? Rules of composition for scheduling and creation seem to be different.
Looping seems to be related more to scheduling of an animation rather than what happens during it. Scheduling api can deal with how many times we should run a given animation. The current loop( true )
signifying infinite times. It could also deal with when ( absolute / relative time ) an animation should be run.
The creation aspect of animation can deal with composing bigger animations out of smaller ones, by connecting them in series or parallel. Transforms like reversed
or scaled
of an animation can be defined. The rules of composition here have a "geometrical" feel to them. All animations have a well defined length.
This is the pseudocode for creating a pulsating button. | = parallel, & = serial.
ButtonZoomInAnim = ButtonScaleAnim | ButtonRotateAnim
ButtonAnim = ButtonZoomInAnim & reverse( ButtonZoomInAnim )
timeline.schedule( ButtonAnim, Now, InfiniteTimes )
I have enjoyed using the composable animations in qml.
Cheers, Bala.
My rewrite of Choreograph a while back was in part aimed at making things like this easier by, as Bala suggests, separating the animation creation and scheduling (which I call description and application in Choreograph).
The repetition sample shows a couple of approaches currently possible using Choreograph's master branch.
The idea of looping in Choreograph can be either part of the motion description (bounce up and down five times) or part of the application (bounce this object, when finished, repeat).
I am occasionally exploring more ideas in other branches of Choreograph, but I think it's worth considering the current version as an alternative to the older concept that was modified and integrated into Cinder.
One thing I often run into when wanting to use
loop()
functionality: I wish it were easier to append animations directly to one Anim, however this is not howappendTo()
works, as that wants to begin when some other animation ends. What I mean is, I'd like to be able to do something like:So alpha stays at 1 for 20 seconds, then 0 for 10 seconds, indefinitely. Instead of the name
append()
,thenApply()
also comes to mind.One thing I tried with the current API, which doesn't seem to be possible:
However the only part of the animation that loops is the fade out - it jumps to full alpha before each fade out begins.