Spritely - Butterfly animation around whole page with change of direction

larrydom

New Member
I've been trying to get Spritely to work by using their documentation. Everything I've done so far has worked fine, but have a few issues which i hope you can help me with. I currently have a butterfly sprite .png with 5 frames which i want to fly around the 'whole' page randomly, and if it flys left it shows the row 1 of the png, and shows the other row when it flys right.The current code below, shows the png image with it's 1st row of 5 frames, which only flys back and forth randomly around a specific area with the same animation when flying back to it's original spot, which looks weird as it's flapping forward but going backwards.For the javascript.\[code\](function($) { $(document).ready(function() { $('#bird') .sprite({fps: 12, no_of_frames: 5}) .spRandom({ top: 70, left: 100, right: 200, bottom: 340, speed: 4000, pause: 3000 }); }); })(jQuery);\[/code\]For the CSS\[code\] #bird { background: transparent url(/fgp/images/butterfly-backward.png) 0 0 no-repeat; position: absolute; top: 150px; left: 65px; width: 30px; height: 30px; z-index: 2000; }\[/code\]and for the HTML \[code\]<div id="bird"></div>\[/code\]But what I want to happen, is for the sprite to fly all around the whole page completely randomly due to it being a static background, and change sprite image, whether it's flying right or left. Does anyone knows how I would achieve this? Here is the Spritely website/documentation for someone with more experience who will have a better idea than me. http://www.spritely.net/documentation/Or maybe another method for doing this?Many thanks,Nathe
 
Back
Top