如何模拟与Parallax.js运动?(How to simulate movement with

2019-10-21 07:06发布

我试图以模拟运动Parallax.js为了测试方法来提高它的性能。

但我怎么环路之间来回00.51对Parallax.js' originXoriginY而可能导致打圈的方式?

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>
文章来源: How to simulate movement with Parallax.js?