|
// 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")
}
|