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) {

            }];

      

  • 相关阅读:
    【总结整理】互联网名词
    【总结整理】数据分析对产品有什么用
    【总结整理】互联网产品的功能设计怎么做
    【总结整理】产品的信息架构
    【总结整理】用完即走
    【总结整理】如何系统地规划出具备上乘用户体验的网站--摘自《人人都是产品经理》
    【总结整理】如何与用户交流---摘自《人人都是产品经理》
    【总结整理】原创概念原创idea---摘自《结网》
    【总结整理】模仿的本质---摘自《结网》
    【转】深入理解java的String
  • 原文地址:https://www.cnblogs.com/bigant9527/p/14177718.html
Copyright © 2011-2022 走看看