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     }];
  • 相关阅读:
    python中自定义模块导入
    EditText------Android
    Fragment类实现
    Android文件访问
    python中pip使用国内镜像提高安装速度
    esri/geometry包 (arcgis api for js)
    【CSDN 编辑器 MarkDowm 使用技巧】
    for 循环 :从指定下标开始,并指定步长
    【车牌识别】-车牌中字符分割代码详解
    【 Linux 常用命令】
  • 原文地址:https://www.cnblogs.com/kc1995/p/13755384.html
Copyright © 2011-2022 走看看