• iOS layer 动画


    x轴缩放:
    CABasicAnimation *theAnimation;
    theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.x"];
    theAnimation.duration=8;
    theAnimation.removedOnCompletion = YES;
    theAnimation.fromValue = [NSNumber numberWithFloat:1];
    theAnimation.toValue = [NSNumber numberWithFloat:0.5];
     [yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

    y轴缩放:
    CABasicAnimation *theAnimation;
    theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.y"];
    theAnimation.duration=8;
    theAnimation.removedOnCompletion = YES;
    theAnimation.fromValue = [NSNumber numberWithFloat:1];
    theAnimation.toValue = [NSNumber numberWithFloat:0.5];
     [yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

    x轴,y轴同时按比例缩放:
    CABasicAnimation *theAnimation;
    theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
    theAnimation.duration=8;
    theAnimation.removedOnCompletion = YES;
    theAnimation.fromValue = [NSNumber numberWithFloat:1];
    theAnimation.toValue = [NSNumber numberWithFloat:0.5];
     [yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

    以上缩放是以view的中心点为中心缩放的,如果需要自定义缩放点,可以设置卯点:
    //中心点
    [yourView.layer setAnchorPoint:CGPointMake(0.5, 0.5)];

    //左上角
    [yourView.layer setAnchorPoint:CGPointMake(0, 0)];

    //右下角
    [yourView.layer setAnchorPoint:CGPointMake(1, 1)];

  • 相关阅读:
    stand meeting
    ubuntu14.04安装百度云Bcloud
    4.1Reduction模型
    3.3分析卷积乘法优化的复用
    3.2 卷积
    3.1 全局存储带宽与合并访问 -- Global Memory(DRAM) bandwidth and memory coalesce
    AngularJS初探:搭建PhoneCat项目的开发与测试环境
    Centos 安装 NodeJS
    git安装
    CentOS安装VSFTP及配置用户
  • 原文地址:https://www.cnblogs.com/XXxiaotaiyang/p/5043327.html
Copyright © 2020-2023  润新知