I have a Bee image and I want to animate it using jQuery.
The idea is to move the image from left (outside of screen) to right (outside of screen) to create an effect like it's flying.
I have a Bee image and I want to animate it using jQuery.
The idea is to move the image from left (outside of screen) to right (outside of screen) to create an effect like it's flying.
In case you want the bee to keep flying across the screen, try this :-)
Try spritely: http://spritely.net/
Your bee needs to be absolutely positioned, something like this:
I've used a div here, but it could just as well be an
<img>
tag. As meo pointed out, don't forget thetop
attribute, because some browsers don't work without it. Then you can animate it:Here is a jsfiddle demo.
If you want to have a continuous animation as Hira pointed out, put the animation code in functions, make sure the left and right movement is the same, and use the onComplete option of animate() to call the next animation:
And the fiddle for that.
i would do something like this: http://jsfiddle.net/Uwuwj/2/
bee careful, this code only works with bee's :P
>