zoukankan      html  css  js  c++  java
  • iOS之动画(transform和UIView动画)学习

      

      1、transform 形变

      这个是UIView的属性,继承UIView的控件都具有这个属性

      UIImageView *imageview=[[UIImageView alloc]init];

        imageview.image=[UIImage imageNamed:@"logo.png"];

        //旋转

        imageview.transform=CGAffineTransformRotate(imageview.transform, 45);

        //位置移动

        imageview.transform=CGAffineTransformTranslate(imageview.transform, 0, 10);

        //缩放

        imageview.transform=CGAffineTransformScale(imageview.transform, 1.5, 1.5);

        //还原

        imageview.transform=CGAffineTransformIdentity;

        [self.view addSubview:imageview];

        

      2、UIView渐变动画

      

      [UIView beginAnimations:@"" context:@""];

        

        [UIView setAnimationDuration:2];

        [UIView setAnimationDelegate:self];

        [UIView setAnimationCurve:UIViewAnimationCurveLinear];

      //监听动画开始事件

        [UIView setAnimationWillStartSelector:@selector(animationDidStart:)];

        //监听动画结束事件

        [UIView setAnimationDidStopSelector:@selector(setAnimationDidStopSelector:)];

    - (void)animationDidStart:(CAAnimation *)theAnimation {

     }

    - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {

     }

      //开启一个线程,处理动画相关的操作

        [UIView animateWithDuration:1.0 animations:^{

            } completion:^(BOOL finished) {

            }];

     //开启一个线程,处理动画相关的操作。

      动画伴随着速率的变化

      /* UIViewAnimationOptionCurveEaseInOut 动画开始/结束比较缓慢,中间相对较快

      UIViewAnimationOptionCurveEaseIn 动画开始比较缓慢

      UIViewAnimationOptionCurveEaseOut 动画结束比较缓慢             

      UIViewAnimationOptionCurveLinear 线性---> 匀速 */

        [UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionCurveEaseIn|UIViewAnimationOptionTransitionCurlDown animations:^{

            } completion:^(BOOL finished) {

         //动画完成后 要执行什么操作

            }];

        //弹性动画

        [UIView animateWithDuration:1.0 delay:0 usingSpringWithDamping:0.3 initialSpringVelocity:200 options:UIViewAnimationOptionTransitionCurlDown animations:^{

            } completion:^(BOOL finished) {

            }];

      

  • 相关阅读:
    网页端打开手机上的app
    iOS 9学习系列:打通 iOS 9 的通用链接(Universal Links)
    自定义 URL Scheme 完全指南
    App开发流程之加密工具类
    iOS8系统H264视频硬件编解码说明
    人脸识别
    app上线具体流程
    第三方分享
    Android摸索-二、解决Android SDK Manager下载太慢问题
    Android摸索一环境搭建
  • 原文地址:https://www.cnblogs.com/bigant9527/p/14177718.html
Copyright © 2011-2022 走看看