zoukankan      html  css  js  c++  java
  • CABasicAnimation

     //闪烁
        [self.mainImageView.layer removeAnimationForKey:@"opacityForever"];
        CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"opacity"];
        animation.fromValue=[NSNumber numberWithFloat:1.0];
        animation.toValue=[NSNumber numberWithFloat:0.0];
        animation.autoreverses=YES;
        animation.duration=0.6;
        animation.repeatCount=1;
        animation.removedOnCompletion=YES;
        animation.fillMode=kCAFillModeForwards;
        
        [self.mainImageView.layer addAnimation:animation forKey:@"opacityForever"];
        /* 放大缩小 */
        [self.mainImageView.layer removeAnimationForKey:@"scale-layer"];
        // 设定为缩放
        CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
        
        // 动画选项设定
        animation.duration = 2.5; // 动画持续时间
        animation.repeatCount = 1; // 重复次数
        animation.autoreverses = YES; // 动画结束时执行逆动画
        
        // 缩放倍数
        animation.fromValue = [NSNumber numberWithFloat:1.0]; // 开始时的倍率
        animation.toValue = [NSNumber numberWithFloat:2.0]; // 结束时的倍率
        animation.removedOnCompletion = YES;
        // 添加动画
        [self.mainImageView.layer addAnimation:animation forKey:@"scale-layer"];
  • 相关阅读:
    MVC5中页面传值,保存,回传
    MVC ajax传递model,ajax接收model
    创建对象的常用四种模式和优缺点
    Promise的用法
    关于深拷贝与浅拷贝
    作用域和作用域链
    谈谈JS中的闭包
    encodeURI和encodeURIComponent区别
    window.scrollTo()
    浮动和常用清除浮动的四种方法
  • 原文地址:https://www.cnblogs.com/KingQiangzi/p/6050013.html
Copyright © 2011-2022 走看看