user6820041
user6820041

Reputation: 1213

Spring Meng To chaining animations?

I don't fully understand the documentation for Meng To's Spring.

https://github.com/MengTo/Spring

The available functions given are

animate()
animateNext { ... }
animateTo()
animateToNext { ... }

and the example for chaining given is :

layer.y = -50
animateToNext {
  layer.animation = "fall"
  layer.animateTo()
}

I don't see anywhere where what these functions do is actually explained. Maybe it's super straight forward and I'm just missing it..

If I wanted to chain together 3 animations of lets just say the layer.animation = "fall" with this, what would an example of that look like and what's the difference between animateNext, animateTo, and animateToNext?

Upvotes: 6

Views: 568

Answers (1)

Florian Ldt
Florian Ldt

Reputation: 1235

you are right that's those functions are not will documented so I faced the same questions when I wanted to implement animations with this library.

To chain 3 animations I do like that :

    view.animation = "pop"
    view.duration = 3
    view.delay = 2
    print("1")
    view.animateToNext {
        self.view.animation = "pop"
        self.view.duration = 3
        self.view.delay = 2
        print("2")
        self.view.animateToNext {
            self.view.animation = "pop"
            self.view.duration = 3
            self.view.delay = 2
            self.view.animate()
            print("3")
        }
    }

It seems that animateNext doesn't wait the end of the previous animation to execute the next one, but animateToNext does it.

Hope it helps.

Upvotes: 4

Related Questions