开发者

Javascript rotate image with mouse coordinates

Im using a parallax effect that moves a ball according to the users mouse position (http://webdev.stephband.info/jparallax/index.html). I am trying to figure out a way that the ball will also rotate. So it would appear that as the user moves their mouse over the area, the ball rolls across the screen.

I have found开发者_如何学Go some javascript examples that show how to rotate an item on mouse click, I am just not skiled enough in js to put it all together.

here is a Jsfiddle that shows an example:

jsFiddle


This is more tangential advice than an answer, but in order to make the rolling ball look realistic, make sure that it rotates at a rate that is consistent with the ball's circumference. Otherwise it will look fakey.

Javascript rotate image with mouse coordinates


This jQuery plugin might be useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜