Skip to content

Commit ad85859

Browse files
committed
refactor(Dat35): keypath
1 parent 974cb0e commit ad85859

File tree

1 file changed

+49
-6
lines changed

1 file changed

+49
-6
lines changed

macOS-dev/Day35-CAAnimation/CAAinamationDemo/CAAinamationDemo/ViewController.swift

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,56 @@ class ViewController: NSViewController {
4040

4141

4242
extension ViewController{
43+
44+
fileprivate func keyAnimationDemo(){
45+
let keyAnimation = CAKeyframeAnimation(keyPath: "position.x")
46+
/**
47+
transform.scale = 比例轉換
48+
49+
transform.scale.x = 宽的比例轉換
50+
51+
transform.scale.y = 高的比例轉換
52+
53+
transform.rotation.z = 平面圖的旋轉
54+
55+
opacity = 透明度
56+
57+
margin=边框间隔?
58+
59+
zPosition = 平面图的位置
60+
61+
backgroundColor = 背景色
62+
63+
cornerRadius = layer的角度
64+
65+
borderWidth = 边框宽度
66+
67+
contents = 内容?
68+
69+
bounds = 大小?
70+
71+
contentsRect = 内容矩形
72+
73+
frame = 位置
74+
75+
hidden = 隐藏
76+
77+
mask = 标记
78+
79+
maskToBounds
80+
81+
position = 位置
82+
83+
shadowOffset = 阴影偏移?
84+
85+
shadowColor = 阴影颜色
86+
87+
shadowRadius = 阴影角度
88+
89+
*/
90+
}
91+
4392
func moveAnimDemo() {
44-
45-
46-
4793
let moveAnim = CABasicAnimation(keyPath: "position.x")
4894

4995
moveAnim.fromValue = 0
@@ -54,12 +100,9 @@ extension ViewController{
54100
moveAnim.isRemovedOnCompletion = false
55101

56102
animLayer.add(moveAnim, forKey: nil)
57-
58-
59103
}
60104

61105
func strokeEndAnmi() {
62-
63106

64107
let animation = CABasicAnimation(keyPath: "strokeEnd")
65108
animation.fromValue = 0

0 commit comments

Comments
 (0)