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

How to get almost no movement? #88

Closed
WaldemarLehner opened this issue Nov 25, 2017 · 7 comments
Closed

How to get almost no movement? #88

WaldemarLehner opened this issue Nov 25, 2017 · 7 comments

Comments

@WaldemarLehner
Copy link

WaldemarLehner commented Nov 25, 2017

I am trying to get an object to nearly don't move at all. How can achieve this?
Using data-rellax-speed="-10" data-rellax-percentage="0" gave me the best result, but is there another, cleaner way to get even less movement?

As far as I understood it values above 0 mean the element is moving faster than the "default" speed, while values below 0 lead to a slower than "normal" speed movement, but correct me if I'm wrong here.

Be aware of the fact that I am using position: absolute; for every Element.

I've attached an archive with the project in it so one can get a better understanding of my situation
web.zip

@WaldemarLehner
Copy link
Author

WaldemarLehner commented Nov 26, 2017

I use a "sort-of" workaround now.
I have a div container that holds the element. Both get rellax data-attributes, so for example:

...
<div id="suncontainer" class="rellax" data-rellax="-10">
          <img src="./src/Sun.svg" id="sun" class="rellax" data-rellax-speed="-10"  data-rellax-center="true"   />
</div>
...

@p-realinho
Copy link
Contributor

Hi!
I've been wanting to reply to this issue but haven't had much time, and I know you found a workaround, but I'll leave my 3 cents anyways, might be useful to someone...
One of the other reasons why I didn't reply earlier is because I believe this issue raises another problem or two.

So, first of all, I must say, I had some fun recreating the archive in codepen, so thank you for that 😅 (most of the code was copy/pasted tho, I just messed around with the shadows, gradients, etc...).

Answering your question, and assuming that the element you were trying to make go slower was the #sun, I changed it's position to fixed, and gave it a data-rellax-speed of 0.3.
That was the easiest / cleanest way I found.
I'm not sure this solution fits your project's needs, cause you do mention you're using position: absolute for every element, so, that might not work for you.

Now, @moeamaya, my question is:
Would it make sense to remove the +-10 and +-5 speed limits?
Cause some people might want to achieve some crazy results or something, and can't because of those clamps.
If not, should it just be explicit in the readme instead?

Another thing I've noticed is that, different viewport sizes mean different ("real") speeds for the same speed setting.
In other words, for example, if I have an element with a data-rellax-speed of -10 and I'm on my laptop, that element will have almost no movement, or none at all.
But, if I test the same thing on, lets say, my phone, that element will be moving faster.
I haven't tested this yet, but I wanted to check in with you first (@moeamaya) and see if you ever noticed that (maybe one of the reasons to keep those speed clams? Cause I think the further you get from speed: 0, the worse is the problem) (again, not sure, didn't test).

@moeamaya
Copy link
Member

moeamaya commented Jan 3, 2018

@p-realinho Yea those are completely artificial limits. Happy to remove them, but keep it in the documentation that it should be from -10 to 10.

@benface
Copy link
Contributor

benface commented Jan 30, 2018

@moeamaya What's the original reason for those limits? I'm curious because I feel like -10 is not slow enough for a background that should look very far away. Would you be open to remove the clamp()s altogether?

@moeamaya
Copy link
Member

moeamaya commented Jan 31, 2018

@benface No good reason, just seemed to be the logical limits when I very first built Rellax back two years ago 🤷‍♀️. Yea if look above I said we could just remove them.

@benface
Copy link
Contributor

benface commented Jan 31, 2018

@moeamaya Would you accept a PR that removes those limits completely?

@moeamaya
Copy link
Member

moeamaya commented Jan 31, 2018

Yup! But add in the README about the relative range of those limits.

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

4 participants