First, Brief introduction
- Core animation is a very powerful set of animation processing APIs that can be used to make very flashy animations, often with less effort.
- Core animation is cross-platform and can be used on Mac OS X and iOS platforms.
- The animation execution of Core animation is performed in the background and does not block the main thread.
- It is important to note that the Core animation is directly acting on the Calayer, not uiview. (Calayer click here)
Second, the use of Core animation steps
- Initializes a Caanimation object and sets some animation-related properties
- Add the Caanimation object to Calayer by calling Calayer's Addanimation:forkey: method to start the animation
- You can stop an animation in Calayer by calling Calayer's Removeanimationforkey: Method
Third, caanimation
Caanimation is the parent class of all animation classes, an abstract class that cannot be used and should use its specific subclasses (the subclasses contain richer animated properties)
Its inheritance structure is as follows:
Attribute resolution: (Red represents a property from the Camediatiming protocol)
Duration: Duration of animation
repeatcount: Number of repetitions of an animation
repeatduration: Repetition time of animation
removedoncompletion: The default is yes, which is removed from the layer after the animation has finished executing, and the drawing reverts to the state before the animation was executed. If you want the layer to remain displayed after the animation has been executed, set it to no, but also set Fillmode to Kcafillmodeforwards
Fillmode: Determines the behavior of the current object during a non-active time period. For example, before the animation starts, the animation ends
beginTime: Can be used to set the animation delay execution time, if you want to delay 2s, set to Cacurrentmediatime () +2,cacurrentmediatime () is the current time of the layer
timingfunction: Speed control function to control the rhythm of animation operation
delegate: Animation agent
iOS Development-core animations (cores Animation)