Swift CABasicAnimation に指定可能なkeypath 一覧

tail -f my tech life.
2 min readNov 7, 2017

--

CABasicAnimation

CoreGraphics+CoreAnimationではCALayerにAnimationを追加するとアニメーションすることができる。

回転の例(上の回転の部分のみ)

let rotateAnim = CABasicAnimation(keyPath: "transform.rotation")
rotateAnim.fromValue = 0
rotateAnim.toValue = CGFloat.pi * 2.0
rotateAnim.duration = 5.0
rotateAnim.repeatDuration = CFTimeInterval.infinity
shapeLayer.add(rotateAnim, forKey: "rotateAnim")

CABasicAnimationのkeyPathに指定可能な値は以下に記載されている。

Animatable Properties Core Animation Programming Guide

transform.rotaion のようなさらに深い部分はこちらを参照すると良い。

Core Animation Programming Guide Key-Value Coding Extensions

--

--

tail -f my tech life.

iOSアプリを作っている、とある技術者のブログです。SwiftやiOS話題多いです。