0. Animation Basics
1, XY coordinate properties: Position (the upper left corner is the origin)
2, Transparency properties: Opacity (transparent: 0.0, Opaque: 1.0)
3. Zoom Properties: Scale (Resize the object, such as the display of the dialog box)
4. Other properties: Color (colour property), Rotate (rotation property), 3D properties (such as 3D rollover)
Think about how the animation is formed
1. Properties of the object at the beginning of the animation
2. Properties of the object at the end of the animation
3. Time of animation execution
4. What happens during animation execution
5. What happens after the animation is over
Animation curve
1. Linear constant Change (Linear)
2. Start at a slow speed: accelerated change (Ease in)
3, first acceleration after the change of deceleration (Ease in,ease out)
4. End at slow speed: deceleration change (Ease out)
1, Uikit and core Animation
UIKit (IOS) and AppKit (OS X)
Core Animation OpenGL ES and OpenGL Core Graphics Graphics Hardware |
// Create Let RedBall = UIView(frame: cgrectmake( c8>, ()) RedBall. BackgroundColor = Uicolor . Redcolor () RedBall. Layer . Cornerradius = - self. View . Addsubview (RedBall) // Ball Zoom Animation UIView. animatewithduration (0.5, delay: 0, options: uiviewanimationoptions. Curveeaseinout, animations: {(), Void in RedBall. Transform = Cgaffinetransformmakescale (2, 2) }) {(Finished:Bool) , Void in Print("finished") } |
override func viewdidload () { Super. Viewdidload () // Create let redball = UIView(frame: cgrectmake( , ()) RedBall. BackgroundColor = Uicolor . Redcolor () RedBall. Layer . Cornerradius = - self. View . Addsubview (RedBall) // Ball Zoom Animation UIView. animatewithduration (0.5, delay: 0, options: uiviewanimationoptions . Curveeaseinout, animations: {(), Void in Redball.transform = Cgaffinetransformmakescale (2, 2) // Combo animation , Cgaffinetransformconcat RedBall. Transform = Cgaffinetransformconcat (cgaffinetransformmakescale(2.0, 2.0), cgaffinetransformmaketranslation (50)) }) {(Finished:Bool) , Void in Print("finished") } } |
Combo Animation:Cgaffinetransformconcat
override func viewdidload () { Super. Viewdidload () // Create let redball = UIView(frame: cgrectmake( , ()) RedBall. BackgroundColor = Uicolor . Redcolor () RedBall. Layer . Cornerradius = - self. View . Addsubview (RedBall) // Ball Zoom Animation UIView. animatewithduration (0.5, delay: 0, options: uiviewanimationoptions. Curveeaseinout, animations: {(), Void in Redball.transform = Cgaffinetransformmakescale (2, 2) // Combo animation , Cgaffinetransformconcat RedBall. Transform = Cgaffinetransformconcat (cgaffinetransformmakescale(2.0, 2.0), Cgaffinetransformmaketranslation(a ) RedBall. BackgroundColor = Uicolor . Greencolor () }) {(Finished:Bool) , Void in Print("finished") } } |
Elastic animation (Spring Animation),IOS 7.0 later have this animation
// Create Let RedBall = UIView(frame: cgrectmake(5 0 , ()) RedBall. BackgroundColor = Uicolor . Redcolor () RedBall. Layer . Cornerradius = - self. View . Addsubview (RedBall) // elastic animations,IOS 7.0 later have this animation UIView. animatewithduration (2.0, delay: 0, usingspringwithdamping: 0.3 ,// elastic damping, the value range is 0-1, the closer to 0, the more elastic effect of animation; if set to 1, the animation will not have an elastic effect initialspringvelocity: 0 , // The speed at which the view starts at the beginning of the animation, usually should be passed in 0 Options: uiviewanimationoptions . Curveeaseinout, animations: {(), Void in RedBall. Transform = Cgaffinetransformconcat ( cgaffinetransformmakescale(2, 2 ),cgaffinetransformmaketranslation(a ) ) RedBall. BackgroundColor = Uicolor . Greencolor () }) {(Finished:Bool) , Void in Print("finished") } |
2, Jnwspringanimation
3. Facebook Pop (Facebook Paper)
iOS Animation Programming-Advanced