MengTo / Spring

A library to simplify iOS animations in Swift.
http://designcode.io
MIT License
14.08k stars 1.8k forks source link

Animate a UIView from one position to another #99

Open bagusflyer opened 9 years ago

bagusflyer commented 9 years ago

Spring is an excellent library for animation. I have one simple question. Does it support animating a UIView from one position to another? Currently it seems it only support to animate a UIView from one position to its container's boundary. Am I right? Thanks

bagusflyer commented 9 years ago

Another question: does Spring support animation for Autolayout? Thanks

schneiderandre commented 9 years ago

Hey @bagusflyer, thanks for your question. Yes, that's possible, and also works with Auto Layout. :+1:

spring(1) {
    self.yourView.frame.origin.x = 200
}

This is one of the animation methods that you can find in the SpringAnimation.swiftfile. It simply wraps UIView Animations with predefined values.

Hope I could help :smile:

bagusflyer commented 9 years ago

Thanks for your reply. Is it possible to give me some sample code regarding with animation of auto layout? Or is it possible to write custom animation?