Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15865

Re: Good way to construct animation player?

Date 2012-09-11 20:48 -0500
Subject Re: Good way to construct animation player?
From Bint <bint@ign.com>
Newsgroups comp.lang.javascript
Message-ID <CC755413.C786%bint@ign.com> (permalink)
References <CC74AF7C.C630%bint@ign.com> <504fe79f$0$23472$ba4acef3@reader.news.orange.fr>

Show all headers | View raw


>> Hello,
>> 
>>    I have an animation gallery online -- the animations are represented as
>> folders of sequentially numbered image frames (PNG files).  I want to make a
>> player for these, where the user can click on a thumbnail and it will play
>> the frames in a loop.
> 
> JS :
> ====
> 
> var nb = 100,        // how many images
>      f  = 'album_01', // folder of these images
>      i,               // the image to display
>      c  = nb;         // a counter
> function player() {
> if(i) document.images.viewer.src = i.src;
> c++;
> if(c >= nb) c=0;
> i = new Image();
> i.onload = function(){ setTimeout('player()',2000);}
> i.src = f + '/' + c + '.png';
> }
> 
> 
> HTML :
> ======
> 
> <div>
> <p><img name="viewer" src="album_01/100.png" alt="ecran"></p>
> <p><button id="but" onclick="player();">play</button>
> </div>
> 
> 
> 
> But ... you can certainly find examples more sophisticated
> ... with fading for instance.
> 
> <http://ygda.free.fr/fonduEnchaine2.htm>

Thanks! -- this looks similar to what I used in the past.  It worked as I
recall, but once the total number of loaded images passed 5MB, it stopped.
Do you know any way around that?  Is there any way to dispose of the memory
used for images I no longer plan to show?

It seems to cache them all and not free the memory, and then it stops being
able to load them around 5Mb.

Bint

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Good way to construct animation player? Bint <bint@ign.com> - 2012-09-11 09:06 -0500
  Re: Good way to construct animation player? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-09-11 08:38 -0600
    Re: Good way to construct animation player? Bint <bint@ign.com> - 2012-09-11 10:41 -0500
  Re: Good way to construct animation player? SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-09-12 03:38 +0200
    Re: Good way to construct animation player? Bint <bint@ign.com> - 2012-09-11 20:48 -0500
      Re: Good way to construct animation player? SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-09-12 12:26 +0200

csiph-web