blaiprat / jquery.animateSprite

Animating sprites using jQuery made easy
http://blaiprat.github.io/jquery.animateSprite/
MIT License
122 stars 39 forks source link

Make animateSprite to use up/down frames #11

Closed petrospap closed 9 years ago

petrospap commented 9 years ago

Hello thanks for this lovely script, really liked, I wrote one small tutorial in our website https://simply4all.net/baaaiL My question: Animation making by using frames from left to right Is there any way to make animation using frames from up to down, this is extremely useful when you try to make banner with dimensions 728 x 90 by using left to right the most images that you can use is almost 41. But if was possible to read from up to down the images that you can use is 333! I would like to see animateSprite to work like this. And one more question, how to make a loop when ends picture to start from beginning, instead to play frames from end to start

blaiprat commented 9 years ago

Hi @petrospap, this is a great tutorial!

I have good news, the feature you're requesting already exists! To do this you have to pass the amount of frames expected from the image using the setting called totalFrames. AnimateSprite will display the first row of frames, once it detects it's the last one available on the first row will jump to a second row.

I've created a small fiddle to show how to use it: http://jsfiddle.net/blaipratdesaba/vmpnfgv7/

Regarding your second question, I've noticed you're using a modified script. Not sure which modifications were made, but if you'll use the original version you'll notice it has the behaviour you are asking. The difference is that the animation will autoplay, something you can change by setting autoplay: fale when starting the project.

I'm closing this issue, but please feel free to comment if you need anything.