Various animation effects of uiview

Source: Internet
Author: User
The most common Animation: // start the animation [uiview beginanimations: Nil context: Nil]; // set the animation duration [uiview setanimationduration: 2]; // The animation content frame. origin. X ++ = 150; [img setframe: frame]; // animation end [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 attribute returns an array of animation images. animationduration = 0.25; // The time used to browse the entire image. myanimatedview. animationrepeatcount = 0; // 0 = loops forever animation repetition times [myanimatedview startanimating]; [self addsubview: myanimatedview]; [myanimatedview release]; catransitio N public API Animation: catransition * animation = [catransition animation]; // animation time animation. duration = 0.5f; // speed up the animation after being slow. timingfunction = uiviewanimationcurveeaseinout; animation. fillmode = kcafillmodeforwards; // animation. removedoncompletion = no; // various animation effects/* kcatransitionfade; clip; kcatransitionpush; zkcatransitionreveal; * // * kcatransitionfromright; kcatransitionfromleft; kcatransitionf Romtop; kcatransitionfrombottom; * // various combinations of animation. type = kcatransitionpush; animation. subtype = kcatransitionfromright; [self. view. layer addanimation: animation forkey: @ "Animation"]; catransition private API Animation: animation. type can be set to the following animation effect Summary:/* suckeffect (triangle) rippleeffect (Water Wave jitter) pagecurl (top flip) pageuncurl (bottom flip) oglflip (top flip) camerairis/camerairishollowopen/camerairishollowclose, It is not recommended to use this function, but the following is the blacklist: speweffect: the new layout is released in the middle of the screen to overwrite the old version. -genieeffect: the old version is sucked out at the lower left or lower right of the screen to display the new layout (Aladdin lamp God?) below ?). -Ungenieeffect: the new layout is released in the lower left or lower right corner of the screen to overwrite the old layout. -Twist: the layout is transferred horizontally like a tornado. -tubey: the layout is vertically attached with an elastic transfer. -Swirl: the old version rotates at 360 degrees and fades out to display a new layout. -charminultra: the old version fades out and displays the new layout. -zoomyin: the new layout goes from small to front, and the old version disappears from front to front. -zoomyout: zoomyout appears outside the screen of the new layout, and the earlier version disappears. -oglapplicationsuspend: the effect of pressing the "home" button. */uiview animations Animation: [uiview beginanimations: @ "animationid" context: Nil]; [uiview setanimationduration: 0.5f]; [uiview setanimationcurve: timeout]; [uiview failed: No]; // The following four 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: + (void) Updated :( nstimeinterval) Duration animations :( void (^) (void )) animations; + (void) animatewithduration :( nstimeinterval) Duration animations :( void (^) (void) animations completion :( void (^) (bool finished) completion; // operations that can be performed after an animation ends. // below is the nested animation effect, which increases first and then disappears. [uiview animatewithduration: 1.25 animations: ^ {export newtransform = convert (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] ;}];

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.