I'm interested in doing a jiggle like animation for a view, similar to what is described in
ios-icon-jiggle-algorithm and error-in-button-jiggle-algorithm
However, these solutions implement time-invariant animations, meaning that the animation sequence is fixed before the animation starts, and exactly the same animation is performed over and over again. In these cases the rotation angle is pre-calculated.
What I want to do is time-variant animation, where by the animation changes with time. In terms of the previous examples I would like the rotation angle to vary according to some time based function.
To give a real life analogy, imagine that I am animating a block of jelly. At the start of the animation I whack the jelly once and it starts shaking, then slowly over time the size of the shakes decrease, until it is not shaking at all.
From my understanding I can't inject a time varying value into the animation block, and the only course of action I think is possible is chaining together strings of fixed animations as per ios-multiple-animation-blocks. With 3 or 4 blocks of decreasing animation values strung together I should get an effect that might be acceptable.
So if there a way of doing what I want with UIView Animations? Or should I be following another approach?
[Edit]
To be a little clearer about what I mean by time-variant, I want to be able to specify the value of the animated property as a function time, without having to precompute the animated property a priori. And to do so in a way that (possibly) allows me to modify the function on the fly. As a concrete example I might want a function f(t) such that:
For t<0 f(t) = 0
For t>0 and t<1 f(t) = 1-t
For t>1 f(t)= 0
Actually a better representation of a f(t) would be something like:
f(t) = A(t)sin(t)
[Edit #2]
After some consideration I've decided that while ideally being able to specify a time varying view animation is the effect I would like to do, pragmatically when it is applied in the App the user won't likely notice my programing greatness. So I am just going to fake it and use key frame animation that is pre-calculated and triggered multiple times.