This demo app shows how to apply spring style animation on a button.
Animation is done by setting Scale
transform to the button inside animation block. This demo app allows to tweak duration
, damping
and velocity
parameters of the animation function.
button.transform = CGAffineTransformMakeScale(0.1, 0.1)
UIView.animateWithDuration(2.0,
delay: 0,
usingSpringWithDamping: 0.20,
initialSpringVelocity: 6.00,
options: UIViewAnimationOptions.AllowUserInteraction,
animations: {
self.button.transform = CGAffineTransformIdentity
}, completion: nil)
The Large Bubble Sound clip is taken from soundbible.com and recorded by snottyboy.