1. หลักๆเลยที่จะกำหนดในนี้ มีดังนี้
fromValue:
toValue:
Duration:
2. รายชื่อ keypath
transform.scale
transform.scale.x
transform.scale.y
transform.rotation.z
opacity
margin
zPosition
backgroundColor
cornerRadius
borderWidth
bounds
contents
contentsRect
cornerRadius
frame
hidden
mask
masksToBounds
opacity
position
shadowColor
shadowOffset
shadowOpacity
shadowRadius
3. ตัวอย่างการใช้งาน
1 2 3 4 5 |
let animation = CABasicAnimation(keyPath: "bounds.size") animation.fromValue = NSValue(CGSize: CGSizeMake(2.0, 2.0)) animation.toValue = NSValue(CGSize: self.imageView.frame.size) animation.duration = 3.0 self.imageView.layer.addAnimation(animation, forKey: "Image-expend") |