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

Learn Python the Hard Way

Learn Python the Hard Way

Zed Shaw / Example Product Manufacturer / 2011

This is a very beginner book for people who want to learn to code. If you can already code then the book will probably drive you insane. It's intended for people who have no coding chops to build up t......一起来看看 《Learn Python the Hard Way》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具