Sly
Parallax Mode
/
Parallax mode provides a great navigation and animation timing interface into which you can chain your animation frame renderer.
// Initiate parallax mode by passing a number into the frame argument
var parallax = new Sly(8000, options);
// Attach a function that renders a frame to `move` event
parallax.on('load move', render);
// Initialize Sly instance
parallax.init();
The rendering function than receives the Sly instance as its this
value, and will be triggered
only when there has been a change in position. With this, you can utilize a lot of Sly's awesomeness. The
move
event is directly chained to requestAnimationFrame
, so you have a smooth
& optimized 60 FPS rendering with build in animation easings support, and all the other Sly's features
out of the box.