0
votes

I have a method which transforms some subviews of my view in a very specific route. so this method has one CGFloat parameter which varies between 0.0f and 1.0f.

I want to know which is the best way to animate this transformations (say it will begin at transform:0.0f and end at transform:1.0f). Obviously UIView's animateWithDuration won't work because I want my subviews to move exactly as I want.

Should I write my own custom interval based animation function to do this? (I dont want to to be honest). Or is there a simple way ?

2
Are animating along a path? Can you describe the animation in greater detail. - Rob
@Rob I'm not sure if i'll be able to describe the transformations precisely. I'll try to explain. There's this method transform:(CGFloat)fraction which transforms 4 views in 3d. So, the starting point is when fraction=0.0f, and the ending point is at 1.0f. But between 0.0f and 1.0f the paths of transformation change several times, that is the reason I can't use UIView animateWithDuration. - spongebob
So I guess I could use NSTimer and call the method with with an acceleration curve, I was wondering if there is another way. - spongebob
Yes, you could use a NSTimer or a CADisplayLink, but when I hear that the "paths of transformation change several times", I think CAKeyframeAnimation, there you can identify some key points in the overall animation. It's hard for me to say without better understanding what you're doing, but hopefully you can dig around for CAKeyframeAnimation or perhaps Core Animation, more generally, and maybe you'll find something that suits your purposes. - Rob

2 Answers

0
votes

use this [UIView animateWithDuration:

[UIView animateWithDuration:<> delay:<> options:<> animations:^{
                         <animation code 1>
} completion:^(BOOL finished){
                         <code for after animatop>
                     }];

like this

[UIView animateWithDuration:<> delay:<> options:<> animations:^{
                         <animation code 1>
} completion:^(BOOL finished){
[UIView animateWithDuration:<> delay:<> options:<> animations:^{
                         <animation code 1>
} completion:^(BOOL finished){
                         <code for after animatop>
                     }];
                     }];
0
votes

If anyone is interested I used this class called CPAccelerationTimer which did the trick. It basically is an NSTimer with custom acceleration