Open vkondrashkov opened 4 years ago
Add API to make it possible to change current animatable target on go
It's possible to achieve same behavior with nesting .runAnimation calls inside .then blocks, but it can lead to enormous amount of indentations, example:
.runAnimation
.then
layer.lotus.runAnimation { $0.make.motion(.vertical).to(200) }.then { /* ... */ }.then { _ in anotherLayer.lotus.runAnimation { $0.make.scaling.to(2) }.then { /* ... */ }.then { _ in yetAnotherLayer.lotus.runAnimation { $0.make.rotation.to(.pi) }.then { /* ... */ } } }
It would make it easier to change target on go for complex animations where chaining is very important and at the same time make code cleaner.
I would like to use block that will return a new target some sort of this:
layer.lotus.runAnimation { $0.motion(.vertical).to(200) }.then { /* ... */ }.changeTarget { return anotherLayer }.then { $0.opacity.to(1) }
This block makes it possible to even create layer on go not just change target
Feature proposal
Add API to make it possible to change current animatable target on go
Alternatives
It's possible to achieve same behavior with nesting
.runAnimation
calls inside.then
blocks, but it can lead to enormous amount of indentations, example:Motivation
It would make it easier to change target on go for complex animations where chaining is very important and at the same time make code cleaner.
Additional
I would like to use block that will return a new target some sort of this:
This block makes it possible to even create layer on go not just change target