Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Javascript Flipbook

  1. #1
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default Javascript Flipbook

    Hello all,
    I have an interesting request from a client, A flipbook made out of javascript. The client sent me about 100 images, all frames from a flipbook, they would like to have them "animate" at about like 3 or 4 frames a second. My idea was to take a slide show script and time it down to like 300 milliseconds. I don't know a lot of javascript and don't worry, I've googled this for awhile and I can't find a solution. Is it better just to make a movie in Windows Movie Maker, or is this possible in JavaScript? My only concern is that the user would literally have to wait for all of the images to load. Can anyone point me in the right direction?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, first I would make an array in java script of all those images with PHP using glob. The javascript shouldnt be so hard. Make a for, then inside make a setTimeout go to the next array.
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    @jscheuer1: I thought he ment that kind of flip book too - but then I thought it couldnt be because he said he searched google and the first results on google are flipbooks like that. I'm pretty sure he wants a flipbook like when you take Post-its and draw little stick figures over 1 millimeter on ever post it, then when you flip through it it looks like hes walking.
    Jeremy | jfein.net

  5. #5
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Again, I'm pretty sure thats not what he is asking for.
    Jeremy | jfein.net

  7. #7
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    ugh, Nile is the only one who gets it. So anyways, I have an array set up with all the files in it. I am also using jquery, which may be helpful. Now I don't know javascript very well, so I'm going out on a limb here; I would know how to do this in php, but not in javascript\jquery. Structurally it would be like:

    Code:
    var imgs = new array("photo01.jpg","photo02.jpg","photo03.jpg");
    
    for(i=0; i<imgs.length; i++) {
    $("#flipbook").delay(500).src(imgs[i]);
    }
    #flipbook is <img id="flipbook" src="" />
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  8. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Yeah, give it a try.
    Remember its new Array()
    Jeremy | jfein.net

  9. #9
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Well, i did some googling and I came up with two solutions, but nether work:

    Code:
    html>
    <head>
    <title>flipbook</title>
    <SCRIPT type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></SCRIPT>
    
    </head>
    <body>
    <img id="flipbook" src="" />
    <script type="text/javascript">
    $(document).ready(function(){
    imgs = new Array("photo01.jpg","photo02.jpg","photo04.jpg");
    $.each(imgs, function(key, img) {
    	//$.delay(1000, function(){$("#flipbook").attr({src: img}); });
    $("#flipbook").animate({"margin-top":"0px"},"1000",function(){$("#flipbook").attr({src: img}); });
    });
    });
    </script>
    </body>
    </html>
    I commented out the first one, the second one does not work either.Any help?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  10. #10
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Hmm this is weird, I tried:
    Code:
    <html>
    <head>
    <title>flipbook</title>
    <SCRIPT type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></SCRIPT>
    
    </head>
    <body>
    <img id="flipbook" src="" />
    <script type="text/javascript">
    $(document).ready(function(){
    var imgs = new Array("images/image1.jpg","images/image2.jpg","images/image3.jpg", "images/image4.jpg", "images/image5.jpg", "images/image6.jpg", "images/image7.jpg", "images/image8.jpg", "images/image9.jpg");
    $.each(imgs, function(key, img) {
    	setTimeout(function() { $("#flipbook").attr('src', imgs[key]) }, 1500);
    });
    });
    </script>
    </body>
    </html>
    But it just skips to image6 and stops... hmm
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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