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

One Click

One Click

Richard L. Brandt / Portfolio Hardcover / 2011-10-27 / 25.95

An insightful look at how Amazon really works and how its founder and CEO makes it happen. Amazon's business model is deceptively simple: make online shopping so easy and convenient that customers ......一起来看看 《One Click》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具