u10int / Kinetic

A flexible tweening library for iOS in Swift similar to GSAP's TweenMax.
MIT License
57 stars 7 forks source link

any way to make value absolute instead of relative? #6

Closed markuswinkler closed 8 years ago

markuswinkler commented 8 years ago

Let's say you have a little animation every time an event occurs and you want to reuse the timeline. In this case, scale the button by 25% and then scale it back to 100%.

Right now I have to use this code:

var timeline= Timeline()
timeline.add(Kinetic.to(square, duration: 0.2, options: [ .Scale(1.25) ]).ease(Easing.inOutSine))
timeline.add(Kinetic.to(square, duration: 0.25, options: [ .Scale(0.8) ]).ease(Easing.inOutSine))

while with most other engines I specify absolute values like this:

var timeline= Timeline()
timeline.add(Kinetic.to(square, duration: 0.2, options: [ .Scale(1.25) ]).ease(Easing.inOutSine))
timeline.add(Kinetic.to(square, duration: 0.25, options: [ .Scale(1) ]).ease(Easing.inOutSine))

The current implementation makes it very very hard to use it for complex animations since you can't guarantee that the item looks exactly the same at the end. Any way there could be an absolute mode?

u10int commented 8 years ago

@markuswinkler I've made some improvements to how transforms are handled in the engine, and now all tween properties are absolute except for a few properties, specifically .Shift() currently. There's some additional refactoring and cleanup I want to do before pushing out a 0.9.1 release, so you can check out these latest changes from master.

Thanks for running the library through some good tests and definitely keep the suggestions coming.

markuswinkler commented 8 years ago

Great! Just tested and confirmed. I've used TweenMax (and GSAP) extensively in the past, your engine makes me feel like home and makes working with cascading animations a delight again (in swift) :).