-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal : Improve Chain-ability #382
Comments
@lastMove Thanks for starting the initiative. The syntax I have a few of ideas as below, they are not concrete, though. I agree with you Can we extract For the chainable animations, shall we use the chain in an instance of Animatble elements e.g. Chainable animation on an instance
Chainable animation on class methods
For the first one, we only specify the UI element (in this case, Just some initial ideas, any feedback are welcome 😁 |
Yes, it's ok for me.
Great syntax 👍 And it's not complicated to implement :) Personally I prefer the first approach seems it seems more natural and easier to read; but they are not exclusive. So it will be something like : view.animate(.slide(.in, .left), duration: 2, damping: 1)
.delay(1)
.then(.pop, duration: 0.3)
.delay(0.5)
.then(.slide(.out, .left), duration: 2, damping: 1)
.completion {
self.label.text = "Done ;)";
} |
@lastMove the syntax looks very good 👍 |
Ok nice, I will try to implement this. |
The goals of this proposal is to improve the Chainability based on the existing with the less possible breaking changes. ( #14 )
Introduce
AnimationConfiguration
One of the problems of Animatable’s Chainability is Animation Parameters.
AnimationType is not enough to describe an Animation.
The animation Parameters (Damping, Velocity, duration, force, delay) are stored directly in the View.
Now when animating we can do
:
let conf = AnimationConfiguration(damping:0.9, velocity: 0.2, duration: 0.3, delay: 0) view.animate(.Pop, configuration: conf)
It’s not a breaking change since configuration is an optional Parameters, and if not specified or nil the old method will be used.
2 - Base the callback system on promises.
A good iOS promises library : Facebook’s Bolts
Welcome to AnimationPromise :
The
animate
method will now return anAnimationPromise
, and will not take anymore in parameter the completion closure.Before :
After :
It's still a work in progress, what do you think about this ?
The text was updated successfully, but these errors were encountered: