iOS 动画 SpringAnimationCALayer

码农软件 · 软件分类 · 动画(Animation) · 2019-07-05 12:11:46

软件介绍

SpringAnimationCALayer 是利用 CALayer 制作弹簧动画效果的一个辅助函数。

使用示例:

  1. 复制 SpringAnimation.swift 文件到你的项目。

  2. 调用 SpringAnimation.animate 函数,绘制 CALayer 的性质。

例如,让一个层绕其X轴翻转:

var transform = CATransform3DIdentity
transform.m34 = -1.0/100.0
myCALayer.transform = CATransform3DRotate(transform, CGFloat(M_PI), 1, 0, 0)
SpringAnimation.animate(myCALayer,
  keypath: "transform.rotation.x",
  duration: 2.0,
  usingSpringWithDamping: 0.7,
  initialSpringVelocity: 1.8,
  fromValue: 0,
  toValue: Double(M_PI),
  onFinished: nil)

目前动画类似于 UIView 的方法. 但是 duration, usingSpringWithDampinginitialSpringVelocity 的值与那些从 UIView 的方法得到的不同。

本文地址:https://codercto.com/soft/d/9461.html

Code Complete

Code Complete

Steve McConnell / Microsoft Press / 2004-6-19 / GBP 40.99

在线阅读本书 Widely considered one of the best practical guides to programming, Steve McConnells original CODE COMPLETE has been helping developers write better software for more than a decade. Now......一起来看看 《Code Complete》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具