jQuery animating along a sine wave

前端 未结 6 1784
-上瘾入骨i
-上瘾入骨i 2021-01-20 01:02

I\'ve spent a couple days at this and I give up.

I\'m trying to get an object to animate along a sine wave infinitely. It should not end after the first period.

6条回答
  •  渐次进展
    2021-01-20 01:18

    Change

     return {top: y + "px", left: current_x + x + "px"}; 
    

    to

      return {top: y + "px", left: last_x + x + "px"};
    

    See an updated fiddle

提交回复
热议问题