zoukankan      html  css  js  c++  java
  • CABasicAnimation 脉冲效果

     1     UIImage *image = [UIImage imageNamed:@"heart.png"];
     2     CALayer *layer = [CALayer layer];
     3     layer.contents = (id)image.CGImage;
     4     layer.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
     5     layer.position = CGPointMake(160, 200);
     6 
     7     layer.transform = CATransform3DMakeScale(0.90, 0.90, 1);  // 将图片大小按照X轴和Y轴缩放90%,永久
     8     [self.view.layer addSublayer:layer];
     9     
    10     CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
    11     animation.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; // 将目标值设为原值
    12     animation.autoreverses = YES; // 自动倒回最初效果
    13     animation.duration = 0.35;
    14     animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    15     animation.repeatCount = HUGE_VALF;
    16     [layer addAnimation:animation forKey:@"pulseAnimation"];
  • 相关阅读:
    相关术语随笔
    JDK简介和mac下安装和查看版本命令
    英语
    英语学习2
    英语学习-19.1
    为什么java是只有值传递而没有引用传递
    线程
    关于同步异步

    jdk动态代理实现原理总结
  • 原文地址:https://www.cnblogs.com/sell/p/2909440.html
Copyright © 2011-2022 走看看