zoukankan      html  css  js  c++  java
  • IOS:个人笔记|UI_渐变动画

     这个挺简单的,就一个方法,弄清楚几个参数的作用就行。直接上例子

     1 //方式一
     2     [UIView animateWithDuration:2.0 animations:^{
     3         CGRect frame=self.imageView.frame;
     4         frame.origin.y-=50;
     5         self.imageView.frame=frame;
     6     }];
     7     //方式二
     8     [UIView animateWithDuration:2.0 animations:^{
     9         CGRect frame=self.imageView.frame;
    10         frame.origin.y-=50;
    11         self.imageView.frame=frame;
    12     } completion:^(BOOL finished) {
    13         NSLog(@"动画结束");
    14     }];
    15     
    16     /*参数说明
    17      动画执行的时间,延迟几秒开始动画,执行的方式,要完成的动画,完成动画要做的事
    18      
    19      执行的方式点进去有很多,目前我们需要知道4种
    20        UIViewAnimationCurveEaseInOut,         // 开始结束比较慢,中间比较快
    21        UIViewAnimationCurveEaseIn,            // 开始比较慢
    22        UIViewAnimationCurveEaseOut,           // 结束比较慢
    23        UIViewAnimationCurveLinear,           //线性,匀速
    24      **/
    25     [UIView animateWithDuration:2.0 delay:2.0 options:UIViewAnimationCurveEaseInOut animations:^{
    26         CGRect frame=self.imageView.frame;
    27         frame.origin.y-=50;
    28         self.imageView.frame=frame;
    29     } completion:^(BOOL finished) {
    30         NSLog(@"动画结束");
    31     }];
    32    
    33  //缩放,其实就是改变frame大小
    34     [UIView  animateWithDuration:2.0 delay:2.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
    35         CGRect frame=self.imageView.frame;
    36         frame.size=CGSizeMake(100100);
    37         self.imageView.frame=frame;
    38         
    39     } completion:^(BOOL finished) {
    40         NSLog(@"动画结束");
    41     }];
    42     //透明度
    43     [UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
    44         self.imageView.alpha-=0.5;
    45     } completion:^(BOOL finished) {
    46         self.imageView.alpha+=0.5;
    47         NSLog(@"动画结束");
    48     }];
  • 相关阅读:
    每日总结
    体温登记app(大年初一要收的作业)慢慢更,这个写完了
    2021/01/31周学习总结
    2021/01/24周学习总结
    从小工到专家
    构建之法阅读笔记
    2021/01/17周学习总结
    人月神话阅读笔记
    利用Word制作Kindle用的6寸PDF电纸书
    面试题-谈谈封装和抽象的区别(转)
  • 原文地址:https://www.cnblogs.com/kc1995/p/13755384.html
Copyright © 2011-2022 走看看