Skip to content
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: Change animatable target on go #47

Open
vkondrashkov opened this issue Feb 19, 2020 · 0 comments
Open

Proposal: Change animatable target on go #47

vkondrashkov opened this issue Feb 19, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@vkondrashkov
Copy link
Member

vkondrashkov commented Feb 19, 2020

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:

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 {
			/* ... */
		}
	}
}

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:

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

@vkondrashkov vkondrashkov added the enhancement New feature or request label Feb 19, 2020
@vkondrashkov vkondrashkov changed the title Change animatable target on go Proposal: Change animatable target on go Feb 19, 2020
@vkondrashkov vkondrashkov added this to the 0.3.0 milestone Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant