iphone - How to keep on rotating a view with a CAKeyFrameAnimation? -
I try to do this: is a scene that has already been rotated in some values, say 15 degrees .
Imagine a scene swirling from 15 degrees.
Next, I only know that I want to rotate this view from the current rotation up to 40 degrees.
Imagine that the scene now rotates from 15 to 40 degrees.
For practice, I want to do it with CAKeyFrameAnimation. But the thing is that from everything I can do it is to make it clear where from where to go, there is no convenient "taking the current state" thing like Uiview Animation, right? How would I go about it?
In addition, I always want to specify 3 keyframe for that rotation, no matter how much rotation is required.
How to visualize it spins from 15 to 40 degrees, to do this, use the keyframe of 3
But another major problem : It may be that, another animation may have to kick with a different goal, say that a scene currently rotates between 20 and 100 degrees, and somewhere between the animation a new animation kicks. And it wants to see that it is simple to go to 15 degrees that the Uiview Ani With the registration to the CAKeyFrameAnimation it?
Actually I want to treat it as a UIView animation that raises the current situation;)
CALayer * theLayer = rotatedView.layer; CAKeyframeAnimation * Animation; Animation = [CAKeyframeAnimationwith animation: @ "transform.rotation.z"]; Animation. Duration = 2; Animation. RepeatCount = 1; Animation. RemovedOnCompletion = No; Animation.philmedia = kCFilModford; Features: [NSARRAAR with object: [NSNumber NumberAffloit: (10.0 / 180.0) * MOPI], [NSNumber Number With-Float: (20.0 / 180.0) * MOPI], [NSNumber Number Explosion (30.0 / 180.0) * MOPI], Zero] ; [TheLayer addAnimation: animation fork: @ "transform.rotation.z"];
You can use theLayer.transform
or Use theLayer.affineTransform
to get the current conversion metrics (before animation), then use it to start from the angle.
Comments
Post a Comment