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

Feature request: speed as a function #232

Open
boneyfantaseas opened this issue May 3, 2021 · 1 comment
Open

Feature request: speed as a function #232

boneyfantaseas opened this issue May 3, 2021 · 1 comment

Comments

@boneyfantaseas
Copy link

To provide non-linear parallax behavior, it'd be nice to allow speed to be configured as a callback function.

Aim: have some temporal delay or offset in the animation scroll effect. See https://www.marvinschwaibold.com/

I know it's maybe to far away from what this plugin should do - but just in case you also thought about it - here's the request :)

@p-realinho
Copy link
Contributor

p-realinho commented May 14, 2021

Hey!

Could this be done with CSS Transitions?

I tinkered with it for a bit, here's what I got:

.rellax {
  /* Similar to your example */
  transition: transform 1s cubic-bezier(0.25, 0.75, 0, 1);
  
  /* Immediately translates, then leaves it "floating" for a bit */
  transition: transform 20s cubic-bezier(0, 1, 0, 1);
  
  /* Similar to the above, but more noticeable */
  transition: transform .5s cubic-bezier(0, 0.5, 0.5, 1); 
  
  /* Simple "delayed" ease */
  transition: transform 1s cubic-bezier(0.5, 0, 0, 1);
}

It's not identical to the example you give, but I think with a little more time and patience, it'd get there.
I know it's kind of a limited solution, because, well, CSS timing functions are kind of limited, compared to what you could do with a JS function, but I think it could work in the plugin's context.

Hope it helps. :)

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