iphone - Rotate in z-axis like core-animation slot machine -


I was able to move or revive my UIView under this code here:

 < Code> - (zero) makeAnim1 {// downstream animation [UIView animethudwidth: 1.5 delay: 0.15 option: UIViewAnimationCurveLinear animation: ^ {carousel.frame = CGRectOffset (carousel.frame, 0, 650); } Closing: ^ (BOOL Finish) {// An animation ends when the task is finished [self performance selector: @selector (makeAnim1_1) withObject: after zero: afternoon: 2.0]; NSLog (@ "Done!"); }]; } - (zero) makeAnim1_1 {// Above the animation [UIView animateWithDuration: 1.5 Delay: 0.1 Option: UIViewAnimationCurveLinear Animation: ^ {carousel.frame = CGRectOffset (carousel.frame, 0, -650); } Closing: ^ (BOOL Finish) {NSLog (@ "Don!"); }]; }   

But just move it up and down UIView how can I spin it like a slot machine but only one The image or the scene is like moving in z z axis but it seems there is more than one image in it.

Thanks for the help.

Instead of changing the frame inside the animation block, you change the to change. The result can be used for visual, rotation and translation (moves). You can only roam around the z-axis but this is what you want. change takes the asset CGAffineTransform to the scene, like:

  // rotate pi / 2 degrees clockwise carousel.transform = CGAffineTransformMakeRotation (M_PI_2 );   

If you have to make more advanced changes such as the rotation of another axis, then you use a little animation and the layer of ideas ( Which takes the CATransform3D instead of CGAffineTransform ].

As with all the core animation code you can import quartzkosk Need is outline and include Quartzcore / Quartzcore in your code

The above EN The Motion you are doing is the UIView Animation, which is only for animate the scenes, but for the animation you are asking for, you need more advanced animation of the Layer Layer. I suggest you use CABasicAnimation Look at the documentation and take a look at the Core Animation Programming Guide for iOS to learn more.

You can also extend the X rotation of a visual layer like this:

  CABasicAnimation * slotAni Mation = [CABasic with Animation Animation: @ "transform.rotation.x"]; [Slot Animation Settle: [NSNumber Number Blast: Mopi_2]]; // Animation customization such as duration and timing // which you can read about the document [[Carousel layer] addAnimation: slotAnimation forKey: @ "mySlotAnimation"];   

The above code will actually rotate the view around the X axis, but without perspective, it will appear very silly ("perspective core animation" for search, it has already been asked). There are probably plenty of tweaking to look right but this should be enough to get you started.

Comments