Catransition transition Animations

Source: Internet
Author: User

Catransition Transition Animations Overview
    • Brief introduction

      • Catransition, also known as transition animation, is a subclass of caanimation that can be used directly
      • Transition animations are primarily used to animate the layer by providing a move-in/move-out screen
      • Common applications for transition animations are Uinavigationcontroller
    • Precautions

      • The default transition mode for transition animations is fade-out mode (Kcatransitionfade)
      • You can assign a value to the Type property of a transition animation using either a constant form or a string, such as

        • Kcatransitionpush, constant form
        • @ "Push", string form
      • There are only four constants for transition animation transitions in official documents.

      • The end value of the animation must be greater than or equal to the start value, otherwise no animation effect

Properties commonly used for transition animations
    • Type (NSString *), the way the animation transitions
    • Subtype (NSString *), the transition direction of the animation
    • Startprogress (float), beginning of animation, with a value range of 0~1, representing the proportions in the entire animation
    • Endprogress (float) animation end point, with a value range of 0~1, representing the proportions in the entire animation
Transitions for transition animations
  • Fade

    • Cross-fade transitions
    • Transition direction not supported
    • The corresponding constant is Kcatransitionfade
  • Push

    • New view launches the old view
    • The corresponding constant is Kcatransitionpush
  • Movein

    • The new view moves above the old view
    • The corresponding constant is Kcatransitionmovein
  • Reveal

    • Move old view off show new view below
    • The corresponding constant is kcatransitionreveal
  • Cube

    • Cube reversal Effect
  • Oglflip

    • Upside-down reversal effect
  • Suckeffect

    • Shrinkage effect, as a piece of cloth is pumped away
    • Transition direction not supported
  • Rippleeffect

    • Drip effect
    • Transition direction not supported
  • Pagecurl

    • Page UP effect
  • Pageuncurl

    • Page DOWN effect
  • Camerairishollowopen

    • Camera lens Open Effect
    • Transition direction not supported
  • Camerairishollowclose

    • Camera lens off effect
    • Transition direction not supported
Transition direction of Transitions animation
    • Kcatransitionfromright, right
    • Kcatransitionfromleft, left
    • Kcatransitionfromtop, ON
    • Kcatransitionfrombottom, down
Example
  • Implementation steps

      • Create a Uiimageview control from storyboard and have it
    @property (weak, nonatomic) IBOutlet UIImageView *imageView;
      • Change the Image property of ImageView
    When you tap the screen, change the picture-(void) Touchesbegan: (nsset *) touches withevent: (uievent *) event{//Control picture loop show static Nsinteger i = p; if (i = = 4) {i = 1;} //Change picture nsstring *imagename = [nsstring stringWithFormat:@ "%zd", I];  Self. ImageView. image = [UIImage imagenamed:imagename];i++;  Add animation [selfsetuptransition];}              
      • Implementing transition Animation Code
    - (void)setupTransition{CATransition *animation = [CATransition animation];//设置动画的过渡方式animation.type = @"oglFlip";//设置动画的过渡方向animation.subtype = kCATransitionFromRight;//设置动画时长animation.duration = 0.5;//将动画添加到图层上[self.imageView.layer addAnimation:animation forKey:nil];}

Catransition transition Animations

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.