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

View sorting and animation timing should be separate concerns #77

Open
ianterrell opened this issue Mar 15, 2017 · 1 comment
Open

View sorting and animation timing should be separate concerns #77

ianterrell opened this issue Mar 15, 2017 · 1 comment

Comments

@ianterrell
Copy link

Currently sort functions are responsible for determining the timing information in an animation. I think that it would be cleaner to separate the two concepts. This would fix a few issues:

  1. Sorting and timing are orthogonal concerns, so separating them would let each piece have a single responsibility.
  2. Currently you can't use "inter-item time" based sort functions with a total duration timing. So it's not possible to have a random animation specified to last 3 seconds. Instead you'd have to do the math yourself knowing the total number of items ahead of time.
  3. Inter-item time is (hypothesis) less useful on average than total duration.

The API could be extended from:

yourView.spruce.animate([.fadeIn, .expand(.slightly)], sortFunction: sortFunction)

to something like

yourView.spruce.animate([.fadeIn, .expand(.slightly)], sortBy: sortFunction, duration: .total(3.0))

or

yourView.spruce.animate([.fadeIn, .expand(.slightly)], sortBy: sortFunction, duration: .withInterItemTime(0.1))
@jacksontaylor13 jacksontaylor13 self-assigned this Mar 20, 2017
jacksontaylor13 added a commit that referenced this issue Mar 20, 2017
Given by issue #77, we introduce this idea of a TimingFunction now. This should allow any sort function to be considered a continuous or inter item function. This separates the notion that the two are related and brings TimingFunction to be an entirely new concept.
@hammas1993
Copy link

how to hide with animate uiview???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants