Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Animation in JS

  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Thanked 0 Times in 0 Posts

    Question Animation in JS


    One of my friends asked me if is possible to read png files and show them as a film (animation). As I know I should to read and show about 25 files per second to make it smooth.

    I know how to read files, and show them. But how to read them all before I start to show them? It is hard to read and show 1 png per second, I think 25 is not possible... so I need to preload them...

    OK I don't have any idea how to solve this...

  • #2
    New Coder
    Join Date
    May 2011
    Thanked 0 Times in 0 Posts
    Sprite sheets....

    All your png images on 1 image in a line equally spaced as "frames", then you change the offset sliding the image x or y 1 frame multiple times/second. When it gets to the end it starts over or shifts down a row and keeps running depending on how many sprites you're using...

    Solves your other problem of waiting until all images are loaded and it cuts down on calls for images.

    Here's a tutorial using jquery http://www.darian-brown.com/2d-sprit...tion-tutorial/
    Last edited by nuBee; 12-19-2011 at 06:28 PM.


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts