Skip to content

Configure view size to allow animation to start at center of view. #8

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

Open
jscottsmith opened this issue May 3, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jscottsmith
Copy link
Owner

jscottsmith commented May 3, 2022

Sometimes users want the animation to begin at the middle of the screen instead of at the bottom. Or they want the animation to end early before the element leaves the view. See react-scroll-parallax #157

To allow this an option can be added to scale the view size (the portion of the scroll area where the element animates).

The new option viewportSize should accept pixels or percent values via the box model. Percent would be based off the view size.

viewportSize: [top, right, bottom, left]

Examples

To configure an element to start animating at the middle of the screen the bottom of the view is adjusted to half the view size:

viewportSize: [0, 0, 50%, 0]

To configure an element to end animating at the middle of the screen the top of the view is adjusted to half the view size:

viewportSize: [50%, 0, 0, 0]

@jscottsmith jscottsmith added the enhancement New feature or request label May 3, 2022
@grandma228
Copy link

Fully support!

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

2 participants