美文网首页
动画相关

动画相关

作者: 胖红Red | 来源:发表于2017-06-26 11:08 被阅读5次

1.简易动画

  • 头尾式

    [UIView beginAnimations:nil context:nil];

    /** 需要执行动画的代码 **/

    /** 提交 **/

    [UIView commitAnimations];

  • Block式

    [UIView animateWithDuration:0.5 animations:^{

      /** 需要执行动画的代码 **/
    

    }];

tip:transform属性

利用transform属性可以修改控件的位移(位置)、缩放、旋转

创建一个transform属性(仔细看这里的方法名,里面有个Make,是和下面进行叠加方法最大的区别)

CGAffineTransform CGAffineTransformMakeTranslation(CGFloat tx,  CGFloat ty) ;
CGAffineTransform CGAffineTransformMakeScale(CGFloat sx, CGFloat sy);
CGAffineTransform CGAffineTransformMakeRotation(CGFloat angle)

(注意:angle是弧度制,并不是角度制)

在某个transform的基础上进行叠加

CGAffineTransformCGAffineTransformTranslate(CGAffineTransform t, CGFloat tx,    CGFloat ty);
CGAffineTransformCGAffineTransformScale(CGAffineTransform t, CGFloat sx, CGFloat sy);
CGAffineTransformCGAffineTransformRotate(CGAffineTransform t, CGFloat angle);

清空之前设置的transform属性

view.transform = CGAffineTransformIdentity;
  • block 式 "带完成的block"
[UIView animateWithDuration:2.0f animations:^{

                            需要执行的代码

                            self.hudLabel.alpha = 1.0;

                            self.hudLabel.text = @"感觉满满的";

                        } completion:^(BOOL finished) {

                            [UIView animateWithDuration:2.0f animations:^{

                                需要执行的代码

                                self.hudLabel.alpha = 0.0f;

                            }];

                        }];
  • block 式 "带完成的block 延迟的时间"

     [UIView animateWithDuration:1.0f animations:^{
    
                 需要执行的代码
    
                 self.hudLabel.alpha = 1.0f;
    
             } completion:^(BOOL finished) {
    
                 延迟十秒 执行动画的代码 执行时间 是  2.0f
    
                 [UIView animateWithDuration:1.0f delay:1.0f options:kNilOptions animations:^{
    
                     需要执行的代码
    
                     self.hudLabel.alpha = 0.0f;
    
                 } completion:^(BOOL finished) {
            }];
    
        }];         
    

相关文章

  • 相关动画

    1.设置View顺时针旋转 //音乐播放旋转 CABasicAnimation *animation = [CAB...

  • 动画相关

    1.简易动画 头尾式[UIView beginAnimations:nil context:nil];/** 需要...

  • 动画相关

    http://www.jianshu.com/p/9fa025c42261

  • 动画相关

    打破盒子模式的限制,使用Clip-Path创建响应式图形 CSS3/SVG clip-path路径剪裁遮罩属性简介...

  • 动画相关

    使用形变属性时,注意:

  • Flutter跨平台移动端开发丨Animation、Animat

    目录 动画相关主要对象 缩放动画 非线性缩放动画 淡入淡出 非线性淡入淡出 平移动画 非线性平移动画 动画相关主要...

  • iOS动画系列一

    前言:做相关demo动画已经有一段时间了、现在闲下来记录下相关动画制作。iOS动画主要就是路径动画、帧动画、缩放动...

  • Android笔记——动画(0):笔记目录

    动画相关——笔记目录列表: 待定... 动画相关——参考博客目录列表: Animation教程_极客学院 Wiki...

  • 相关类对应功能

    RxUtils RxAnimationTool(动画相关) RxAppTool(应用相关) RxBarTool(状...

  • js动画相关

    获取不含Border样式的兼容写法 获取相对于文档的位置jquery中使用 $("#id").offset() 原...

网友评论

      本文标题:动画相关

      本文链接:https://www.haomeiwen.com/subject/nhknfxtx.html