iOS various animation effects

Source: Internet
Author: User

iOS various animation effects

Most common animations:
Start animation
[UIView Beginanimations:nil Context:nil];
Set Animation duration
[UIView Setanimationduration:2];
The content of the animation
Frame.origin.x + = 150;
[img Setframe:frame];
End of animation
[UIView commitanimations];

Continuous Animation: Displays a series of images one by one
Nsarray *myimages = [Nsarray arraywithobjects:
[UIImage imagenamed:@ "Myimage1.png"],
[UIImage imagenamed:@ "Myimage2.png"],
[UIImage imagenamed:@ "Myimage3.png"],
[UIImage imagenamed:@ "Myimage4.gif"], nil];

Uiimageview *myanimatedview = [Uiimageview alloc];
[Myanimatedview initwithframe:[self bounds];
Myanimatedview.animationimages = MyImages; The Animationimages property returns an array that holds the animated picture
Myanimatedview.animationduration = 0.25; The time it takes to browse the entire picture at once
Myanimatedview.animationrepeatcount = 0; 0 = Loops Forever Animation Repeat Count
[Myanimatedview startanimating];
[Self addsubview:myanimatedview];
[Myanimatedview release];

Catransition Public API Animations:
Catransition *animation = [catransition animation];
Animation time
Animation.duration = 0.5f;
Slow down first, fast.
Animation.timingfunction = Uiviewanimationcurveeaseinout;
Animation.fillmode = Kcafillmodeforwards;
Animation.removedoncompletion = NO;

Various animation effects
/*
Kcatransitionfade;
Kcatransitionmovein;
Kcatransitionpush;z
Kcatransitionreveal;
*/
/*
Kcatransitionfromright;
Kcatransitionfromleft;
Kcatransitionfromtop;
Kcatransitionfrombottom;
*/
Various combinations
Animation.type = Kcatransitionpush;
Animation.subtype = Kcatransitionfromright;

[Self.view.layer addanimation:animation forkey:@ "animation"];

Catransition Private API Animations:
Animation.type can be set to the following effects
Animation Effects Summary:
/*
Suckeffect (triangle)

Rippleeffect (Wave jitter)

Pagecurl (Page UP)

Pageuncurl (Next page)

Oglflip (Upside Down)

Camerairis/camerairishollowopen/camerairishollowclose (lens shutter, this group of animations is effective, just hard to see, not recommended to use

And the following is the blacklist:

Speweffect: The new layout is released in the middle of the screen, overwriting the old layout.

-Genieeffect: The old layout is sucked away in the lower left or bottom right of the screen, showing the following new layout (Aladdin lamp God?).

-Ungenieeffect: The new layout is released in the lower left or bottom right of the screen to cover the old layout.

-Twist: The layout is turned out in a horizontal direction like a tornado.

-Tubey: The layout is vertically attached to the elasticity of the turn out.

-Swirl: The old layout is rotated 360 degrees and fades out to show the new layout.

-Charminultra: The old layout fades out and displays the new layout.

-Zoomyin: New layout from small zoom to the front, the old layout enlarged by the front disappears.

-Zoomyout: The zoom appears outside the new layout screen, and the old layout shrinks away.

-Oglapplicationsuspend: Effect like pressing "Home" button.
*/

UIView Animations Animation:
[UIView beginanimations:@ "Animationid" context:nil];
[UIView setanimationduration:0.5f];
[UIView Setanimationcurve:uiviewanimationcurveeaseinout];
[UIView Setanimationrepeatautoreverses:no];
The following four kinds of effects
/*
[UIView setanimationtransition:uiviewanimationtransitionflipfromleft ForView:self.view Cache:yes];//oglflip, Fromleft
[UIView setanimationtransition:uiviewanimationtransitionflipfromright ForView:self.view Cache:yes];//oglflip, Fromright
[UIView Setanimationtransition:uiviewanimationtransitioncurlup ForView:self.view Cache:yes];
[UIView Setanimationtransition:uiviewanimationtransitioncurldown ForView:self.view Cache:yes];
*/

[Self.view exchangesubviewatindex:1 withsubviewatindex:0];
[UIView commitanimations];
IOS4.0 New Method:
Method: + (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void)) animations;
+ (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void)) animations completion: (void (^) ( BOOL finished)) completion; One more action that can be performed after an animation is finished.
The bottom is the animated effect of nesting, first getting bigger and disappearing.
[UIView animatewithduration:1.25 animations:^{
Cgaffinetransform Newtransform = Cgaffinetransformmakescale (1.2, 1.2);
[Firstimageview Settransform:newtransform];
[Secondimageview settransform:newtransform];}
completion:^ (BOOL finished) {
[UIView animatewithduration:1.2 animations:^{
[Firstimageview setalpha:0];
[Secondimageview setalpha:0];} completion:^ (BOOL finished) {
[Firstimageview Removefromsuperview];
[Secondimageview Removefromsuperview]; }];
}];

iOS various animation effects

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.