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

There is a question about the position parameter in the delegate #3

Closed
broccolii opened this issue Feb 19, 2017 · 4 comments
Closed

Comments

@broccolii
Copy link

If I set the width and spacing of the CollectionItem, then how do I calculate the position parameter in the Delegate I need to modify the original code logic if there is a better way to deal with this ?

@broccolii
Copy link
Author

Sorry, I just saw the README TODO content, expect to give a perfect solution

@broccolii broccolii reopened this Feb 19, 2017
@KelvinJin
Copy link
Owner

Hey @broccolii, this is a good question! I'm also trying to find the best way to support such scenario.

Two cases pop up in my mind:

  • Each item (including the spacing between items) takes a fullscreen space.
  • Each item (including the spacing between items) takes part of the screen. So you'd have two or more visible items at the same time.

In the first scenario, it's still reasonable to have animations such as CrossFade or ZoomInOut but not Cube for instance. However, the second scenario makes even CrossFade inappropriate. (Cards might still be alright though.)

What type of scenario are you looking for?

@broccolii
Copy link
Author

@KelvinJin
I see FSPagerViewTransformer in FSPagerView when found to be a good solution, so I made some changes, honestly I think the definition of the parameters here is not easy to understand, so I mentioned this in the pull request. Although it is not a good solution, but it is useful

@KelvinJin
Copy link
Owner

KelvinJin commented Feb 20, 2017

@broccolii Yeah, for a complicated animation, the parameters will be hard to define. IMHO, the library should give you the ability to customise the animation by providing enough contexts.

I'm planning to add more context information into the UICollectionViewLayoutAttributes. For instance, the scroll direction, the distance between the centre of the item and the centre of the collectionView, the distance between the start (depending on the scroll direction) of the item and the start of the collectionView and the distance between the end of the item and the end of the collectionView. With all the information, you can create your own animations such as slide in when you scroll the list.

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

No branches or pull requests

2 participants