geosigno / simpleParallax.js

Easy Parallax Effect for React & JavaScript
https://simpleparallax.com
MIT License
1.86k stars 141 forks source link

Using a speed instead of scale. #1

Closed inerds closed 6 years ago

inerds commented 6 years ago

Right now scale factor is being used as speed of transformation as-well right?

I am in a situation where i donot want any scaling on the image and just wants its parallax movement (translate X / Y). Is there any way to achieve this ?

geosigno commented 6 years ago

This is a pertinent point.

However, the main idea of this plugin is to have parallax effects apply directly on image tags without breaking the layout.

In order to do so, the image scale gives "extra" image matter comparing to its initial size in the viewport. The range is calculated from this extra space and the image can translate between its min and max range.

So the positions (min and max range) are actually set automatically to have an image translating and never going out of its original flow in the viewport.

I hope I make myself clear... I'll try to add a schema later to explain how this plugin is working.

inerds commented 6 years ago

@geosenna thanks for clearing out your goal of the plugin. I have managed to modify the plugin to suit my requirement of translating only.

Look forward to see more updates of this project

Cheers !

drstrangelovesg commented 5 years ago

Hi @inerds mind sharing how you manage to change from scaling to just translating only?

thanks