Details
Description
Summary:
App developers would like to apply a spring/bounce animation when a view reaches its end-point. This is desired for both translation, rotation, and scale animations.
Proposed Properties:
- "dampingRatio": Normalized value where 1.0 will reach its end-point without overshooting and no bounce/spring effect. A value less than 1.0 will overshoot its end-point and apply a spring animation, where the lower the value, the more the view will bounce back and forth until it slows down and reaches its end-point. A value of 0.0 will bounce back and forth forever without any damping effect.
- "springVelocity": Scale factor where 1.0 represents the total spring animation distance traversed in 1 second. The lower the value, the slower the spring effect. The higher the value, the faster the spring animation. For example, 2.0 will reach the end-point twice as fast and 0.5 will reach the end-point at half-speed.
Notes:
In iOS (Swift is the example code I'm using below), there are a few spring based properties that can be added to a UIView animation, for example to get this bounce effect, it's just two properties - https://www.dropbox.com/s/n9dx2yw54kr895a/2015-01-21_08-55-58.mp4?dl=0 :
UIView.animateWithDuration(0.5,
|
delay: 0,
|
usingSpringWithDamping: 0.7,
|
initialSpringVelocity: 0.7,
|
options: nil,
|
animations: {
|
|
// Animated views here
|
|
}, completion: nil)
|