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

Origin point changing #48

Closed
mrDinckleman opened this issue Dec 11, 2013 · 3 comments
Closed

Origin point changing #48

mrDinckleman opened this issue Dec 11, 2013 · 3 comments

Comments

@mrDinckleman
Copy link

Good day!
Is there any way to change origin point of movement? Like "xorigin" and "yorigin" options in jParallax plugin (http://stephband.info/jparallax/)?
Or the only way - to change Plugin.prototype.onMouseMove function?

Left top corner:

  Plugin.prototype.onMouseMove = function(event) {
    // Calculate Input
    this.ix = 1 + (event.pageX - this.hw) / this.hw;
    this.iy = 1 + (event.pageY - this.hh) / this.hh;
  };

Right bottom corner:

  Plugin.prototype.onMouseMove = function(event) {
    // Calculate Input
    this.ix = -1 + (event.pageX - this.hw) / this.hw;
    this.iy = -1 + (event.pageY - this.hh) / this.hh;
  };
@mrDinckleman
Copy link
Author

Good day.
There is a need to change the origin point again, but now on mobile devices. Does anyone know how to fix it?

@WebMaestroFr
Copy link

Hello,
I wanted to change the origin as well, and managed to position it to the center of the context like this :

var api = $('#scene').parallax().data('api');
api.hh = api.oy + (api.oh / 2);
api.hw = api.ox + (api.ow / 2);

@wagerfield
Copy link
Owner

Hi Guys, thanks for your interest in parallax. I have just added this control to the behaviours in v2.1.1. You can also read about the behaviours in the updated README.

Please note that this new behaviour only works with the mouse input. It does not make sense to alter the calibration of the gyroscope.

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

3 participants