Scrollmonitor Parallax
Installation
npm install -S scrollmonitor-parallax
Examples
Basic Usage
var parallax = require('scrollmonitor-parallax');
var eases = require('eases');
var parallaxRoot = parallax.create(domElement);
var parallaxChild2 = parallaxRoot.add(domElement, 0.5);
var parallaxChild = parallaxRoot.add(
domElement, {
start: {
opacity: 0
}
end: {
x: 100,
y: 50,
z: 100,
opacity: 0.7
},
easing: {
x: eases.linear,
y: eases.linear,
z: eases.circIn,
opacity: eases.bounceIn
}
}
);
Existing ScrollMonitor
If you need to create your own ScrollMonitorContainer
, you may create a parallax root and pass an existing container as the third parameter, and scrollmonitor-parallax will use that instead of using the default ScrollMonitorContainer
instance:
var scrollMonitor = require('scrollmonitor');
var parallax = require('scrollmonitor-parallax');
var container = scrollMonitor.createContainer(document.body);
var parallaxRoot = parallax.create(domElement, null, container);