The main basis for the animation of CALayer provides an operating variable attributes for simple animation. For example: displacement, transparency, scaling, rotation, background color, and so on. The basic idea is to use CABaseAnimation set to adjust the properties of the initial value, end value, interpolation mode, then the animation added to the appropriate layer up. CABasicAnimation can set the start value keyPath, the end value of the animation will move along the set point. CABasicAnimation can be seen as only two key points of special CAKeyFrameAnimation.
Attributes
Attributes
Explanation
fromValue
corresponding to the initial value keyPath
toValue
Corresponding to the end value keyPath
byValue
The same amount of change of the initial value of the attribute change
keyPath property
Attributes
Explanation
transform
3D transformation, [NSValue valueWithCATransform3D: CATransform3DMakeScale (0.5, 0.5, 0)], directly the 3D transformation
transform.scale
Scaling, @ (1.5), 1.5 enlarge
transform.scale.x
Scaling width, @ (1.5), Wide Zoom 1.5
transform.scale.y
Height scaling, @ (1.5), a high amplification 1.5
transform.rotation.x
Around the x axis, @ (M_PI), x-axis rotated by 180 degrees
transform.rotation.y
About the y axis, @ (M_PI), y-axis is rotated 180 degrees
transform.rotation.z
About the z axis, @ (M_PI), z-axis is rotated 180 degrees
position
Position (center point changes), [NSValue valueWithCGPoint: CGPointMake (100, 100)], becomes a central point (100, 100)
opacity
Transparency, @ (0.5), the transparency becomes 0.5
bounds
Changes in the size, center point remains unchanged, [NSValue valueWithCGRect: CGRectMake (0, 0, 300, 300)], size becomes (300,300)
cornerRadius
Rounded set @ (5), rounded to 5
backgroundColor
Background color conversion, (id) [UIColor redColor] .CGColor, background changed to red contents, you can change the image layer display, (id) [UIImage imageNamed: @ "12.png"] CGImage, the UIView display picture to change. as 12.png
strokeStart
Changes from the start point, fromValue = 0, toValue = 1, the properties of CAShapeLayer
strokeEnd
Starts to change from the end position, fromValue = 1, toValue = 0.5, the attribute CAShapeLayer
path
The path to change
rotaion.x
Rotation, in radians, X-axis
rotaion.y
Rotation, in radians, Y-axis
rotaion.z
Rotation, in radians, Z axis
rotaion
Rotation, in radians, Z-axis, exactly the same rotation.z
contents
Content, such as pictures UIImageView imageAnima.toValue = (id) [UIImage imageNamed: @ "to"] CGImage;.
opacity
Transparency as @ (0.7)
contentsRect.size.width
@ Transverse stretching scaling (0.4) is preferably between 0 and 1