zoukankan      html  css  js  c++  java
  • 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)];

  • 相关阅读:
    Tkinter组件之Entry
    Tkinter组件之LabelFrame
    Tkinter组件之Frame
    Tkinter组件之Radiobutton
    Tkinter 组件详解之Checkbutton
    Tkinter组件之Label
    Tkinter组件之Button
    Tkinter:事件绑定
    特征点匹配方式的选择
    跑通SOLOV1-V2实例分割代码,并训练自己的数据集
  • 原文地址:https://www.cnblogs.com/XXxiaotaiyang/p/5043327.html
Copyright © 2011-2022 走看看