• 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     }];
  • 相关阅读:
    015.Delphi插件之QPlugins,FMX插件窗口
    014.Delphi插件之QPlugins,MDI窗口
    013.Delphi插件之QPlugins,模块化代码示例
    012.Delphi插件之QPlugins,多实例内嵌窗口服务
    011.Delphi插件之QPlugins,延时加载服务
    010.Delphi插件之QPlugins,遍历服务接口
    009.Delphi插件之QPlugins,服务的热插拔
    008.Delphi插件之QPlugins,服务的两种调用方法
    007.Delphi插件之QPlugins,插件的卸载和重新加载
    006.Delphi插件之QPlugins,多服务演示
  • 原文地址:https://www.cnblogs.com/kc1995/p/13755384.html
Copyright © 2020-2023  润新知