zoukankan      html  css  js  c++  java
  • View--Animation

    1.头尾式动画

    开启动画

    [UIView beginAnimations:nil context:nil];

    设置动画执行时间

    [UIView setAnimationDuration:0.5];

    ---动画的内容---

    提交动画

    [UIView commitAnimations];

    2.block式动画

    [UIView animateWithDuration:0.5 animations:^{

    ---动画的内容---        

    }];

     

    每一种都有一次和多次两种

    transform的没有真正改变图片,只是有动画的动作

    平移

        [UIView animateWithDuration:0.5 animations:^{

            self.PinkView.frame = CGRectMake(_PinkView.frame.origin.x, _PinkView.frame.origin.y + 100,_PinkView.frame.size.width,_PinkView.frame.size.height);

        }];改变了图片的位置

        [UIView animateWithDuration:0.5 animations:^{

            _PinkView.transform = CGAffineTransformTranslate(_PinkView.transform, 10, 10);

        }]; 没有改变图片的位置

     

    渐变

        [UIView animateWithDuration:0.5 animations:^{

            self.PinkView.alpha = !self.PinkView.alpha;

        }];

     

    翻页效果

        [UIView beginAnimations:nil context:nil];//开始动画的配置

        [UIView setAnimationDuration:0.5];

        [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_PinkView cache:NO];

        [UIView commitAnimations];//动画配置完毕,提交动画

     

    旋转,只能做一次

          [UIView animateWithDuration:0.5 animations:^{

             _PinkView.transform = CGAffineTransformMakeRotation(M_PI);

          }];

        多次

        [UIView animateWithDuration:0.5 animations:^{

            _PinkView.transform = CGAffineTransformRotate(_PinkView.transform, M_PI_4);

        }];

     

    放大缩小

        [UIView animateWithDuration:0.1 animations:^{

            _PinkView.transform = CGAffineTransformMakeScale(2, 2);

        }];

        [UIView animateWithDuration:0.5 animations:^{

            _PinkView.transform = CGAffineTransformMakeScale(0.5, 0.5);

        }];

        

    还原

       _PinkView.transform = CGAffineTransformIdentity;

  • 相关阅读:
    [BZOJ]2132: 圈地计划 最小割
    从最近MySQL的优化工作想到的
    Linux基本操作 9----- 认识与学习bash
    多路径配置vlome group共享存储,VG的更新。
    两位数乘法的速算方法(一)
    请对他有足够的重视——设计!
    ASP.NET中配置应用程序
    flex开发小技巧集锦
    刚制作完的SAP Sybase ASE15.7 [Sybase Central] 客户端
    Static 关键字的 5 种用法,你会几种?
  • 原文地址:https://www.cnblogs.com/huoran1120/p/5155394.html
Copyright © 2011-2022 走看看