Thanks to the author’s open source Spring other animation can also refer to this English document animation is very easy to use a third party library animation, special effects. However, there is no comment in the demo, so it is not clear how to use it. Here is how to use it in the project.

How is it integrated into the project

Manual and COcoaPods integration is supported according to the README document written by the author. Manual integration is simply a matter of dragging the Spring folder into the project.

Used in the project

Import the header file import Spring.

Controls that need to be animated can be inherited from SpringView.

Then add the animation effect you want. For example, set the animation:

    letballView = SpringView() ballView.backgroundColor = UIColor.red ballView.frame = CGRect(x: 10, y: 50, width: 100, height: 100) self.view.addSubView (ballView) // Set the specific animation form funcsetOptionsDuration = 1.0 // Animation duration ballView.delay = 0.6 // Animation delay time BallView.damping = 0.7 ScaleX = 0 ballview. scaleX = 0 ballview. scaleX = 0 ballview. scaleX = 0 Rotate = 0 ballview. x = 0 ballview. y = 0 ballview. rotate = 0 ballview. animation ="Shake"// Animation style ballview.curve ="easeOut"// Animate into or out of style} ' '# Here's one thing to note:To animate, one of the following four parameters must be implemented: ScaleX, // Effects spread out along the Y axis, range 0~1 scaleY, // Effects spread out along the Y axis, range 0~1 x, // the displacement of the starting position on the x axis, the end of the animation will be returned to the starting position along the X axis, the size is set arbitrarily, Y // can be positive or negative. The animation will return to the starting position along the Y axis at the end of the animation, and the size can be set arbitrarily. Other parameters, including 'animation effect' and 'curve', have default values and can be ignored.#### above such an animation is integrated

### How to start animation'ballView.animate()' will animate. And this one, once the animation is done, you can do whatever you want. ``` ballView.animateNext {print("The action performed when the animation is complete."As for the methods ballview.animateto () and ballview.animatetonext {print("Do somethings"} ' ' 'use, reference code:Copy the code
    modalView.animation = "slideRight"
    modalView.animateFrom = false
    modalView.animateToNext(completion: {
        self.dismiss(animated: false, completion: nil)
    })```
Copy the code

What does that mean? The animation is set to perform the above action, the end of the action, in the next action (animation will remove? Meng forced the specific how to see the demo source effect to go.

Jump interaction between interfaces

Present, dismiss, push, pop, and so on. You can also set transform styles. It doesn’t matter. What do you do if you want SpringView animation? Just inherit the animation you want to add from SpringView, and then add the animation. You can animate one View, you can animate several views. * How to animate the entire interface? * My solution is to add the same large view to self.view, add all the controls to it, and make the view inherit from SpringView, then add the animation.

##### do not know how everyone is realized, but also hope to give advice to tell. O O (studying studying) thank you

Add some animation coordinates and styles

"Ease" : ". 25,. 1. 25, 1 ",

"Linear" : "0,0,1,1",

"Ease - in" : ". 42,0,1,1 ",

"Ease - out" : "58, 1, 0, 0,",

"Ease - in-out" : "., 42, 0. 58, 1 ",

EaseInSine: "0.47, 0, 0.745, 0.715",

  "EaseOutSine": "0.39, 0.575, 0.565, 1",

EaseInOutSine": "0.445, 0.05, 0.55, 0.95",

EaseInQuad: "0.55, 0.085, 0.68, 0.53",

EaseOutQuad: "0.25, 0.46, 0.45, 0.94",

EaseInOutQuad: 0.455, 0.03, 0.515, 0.955",

  "EaseInCubic": "0.55, 0.055, 0.675, 0.19",

"EaseOutCubic": "0.215, 0.61, 0.355, 1"

"EaseInOutCubic": "0.645, 0.045, 0.355, 1"

EaseInQuart: "0.895, 0.03, 0.685, 0.22",

EaseOutQuart: "0.165, 0.84, 0.44, 1",

EaseInOutQuart: "0.77, 0, 0.175, 1",

EaseInQuint: "0.755, 0.05, 0.855, 0.06",

EaseOutQuint: "0.23, 1, 0.32, 1",

EaseInOutQuint: "0.86, 0, 0.07, 1",

EaseInExpo: "0.95, 0.05, 0.795, 0.035",

"EaseOutExpo": "0.19, 1, 0.22, 1"

  "EaseInOutExpo": "1, 0, 0, 1",

EaseInCirc: "0.6, 0.04, 0.98, 0.335",

EaseOutCirc: "0.075, 0.82, 0.165, 1",

EaseInOutCirc": "0.785, 0.135, 0.15, 0.86",

EaseInBack: "0.6, -0.28, 0.735, 0.045",

EaseOutBack: "0.175, 0.885, 0.32, 1.275",

  "EaseInOutBack": "0.68, -0.55, 0.265, 1.55"

} ` ` `

Concrete animation path



! [track image.png](http://upload-images.jianshu.io/upload_images/2286585-1631a2520554431b.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)





# # note

> demo there are many details, such as modal page presention and presenting interaction, through the UIApplication. SharedApplication () sendAction (" minimizeView: ", to: Nil, from: self, forEvent: nil) and delegate implementations

It's worth learning. You can also use this method to get first responders.

Copy the code