Move a div in a curved path (like tweening in Flash old days)?

前端 未结 4 1024
谎友^
谎友^ 2020-12-05 16:34

I\'d like to build a function like

fromHeretoThere(x1,y1,x2,y2){
  //....
}

So that I can move a

or an image from
4条回答
  •  没有蜡笔的小新
    2020-12-05 17:20

    Using jQuery animate's step function you can animate in any curve you'd like.

    For some things using a canvas is better, but for most small and simple animations just changing css values with jQuery (this is what animate does) is faster and simpler.

    Here's a quick demonstration I made, built on top of the jQuery.path plugin : http://jsfiddle.net/zVddG/

提交回复
热议问题