我试图以模拟运动Parallax.js为了测试方法来提高它的性能。
但我怎么环路之间来回0
, 0.5
和1
对Parallax.js' originX
和originY
而可能导致打圈的方式?
http://jsfiddle.net/frank_o/amvvkm9z/
伪代码:
var scene = $('#scene');
scene.imagesLoaded(function() {
var circularMovement = [
[0,0],
[0.5,0],
[1,0],
[1,0.5],
[1,1],
[0.5,1],
[0,1],
[0,0.5]
];
// Initiate Parallax
scene.parallax({
originX: 0,
originY: 1
});
circularMovement.each(function() {
scene.parallax('origin', N, N);
});
scene.masonry({
itemSelector: '.layer'
});
});
HTML:
<ul id="scene">
<li class="layer" data-depth="0.00">
<img src="http://lorempixel.com/50/50">
</li>
<li class="layer" data-depth="0.20">
<img src="http://lorempixel.com/50/50">
</li>
...
</ul>