Spring animation

The Springs animation, just like the real spring animation, accelerates and damps instead of moving in a straight line. IOS Springs Animate involves two parameters:

  1. UsingSpringWithDamping: controls damping or deceleration. The parameter size is 0.0 to 1.0. A parameter close to 0.0 is an elastic animation, and a parameter close to 1.0 creates a stiff effect.
  2. InitialSpringVelocity: Initial animation speed. Set the initial momentum, the size of the parameter can cause the animation speed size.

eg.

Uiview.animate (withDuration: 0.5, delay: 0.5, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.0, options: [], animations: {self. LoginButton. Center. Y - = 30.0 self. LoginButton, alpha = 1.0}, completion: nil)Copy the code

Attached: Demo download