Original Usenet thread from alt.ascii-art, started 25 Aug 1997.
_ _ _ _ _ _ | | | |___ ___ _ __ ___| |_ / \ _ __ ___| |__ (_)_ _____ | | | / __|/ _ \ '_ \ / _ \ __| / _ \ | '__/ __| '_ \| \ \ / / _ \ | |_| \__ \ __/ | | | __/ |_ / ___ \| | | (__| | | | |\ V / __/ \___/|___/\___|_| |_|\___|\__| /_/ \_\_| \___|_| |_|_| \_/ \___|
A fix for the large javascript animation problems
alt.ascii-art
· 1 message · 25 Aug 1997
KANGAROO wrote: > > In recent times there has been a bit about how Netscape 3.0 (16bit at > least) isn't able to view some animations because they're too big! Now, > I'm not sure if an answer to that problem was ever found... but I was > fiddling around and I got the larger animations to work :) > > It has been said that you can't have animations over 750 lines... well I > gotta disagree. I think that netscape either allows a certain maximum > size for a variable, or a maximum size for something between the > "script" tags (as in bytes). > > Anyways, here is how I did it: > You simply split the variable containing the frames into two :) - It > involves a little more complicated javascript.... > > This is it: (My javscript version differs slightly from others.. but > means the same) > > <script language="JavaScript"> > var max=0; > var maxnext=0; > var x=0; > var nl="\r\n"; > > function FrameList() > { > if (max==0) > { max=FrameList.arguments.length > for(i=0;i<max;i++) this[i] = FrameList.arguments[i]; > } else > { maxnext=FrameList.arguments.length > for(i=0;i<maxnext;i++) this[i] = FrameList.arguments[i]; > } > } > function tick() > { > document.animation.viewer.value = cartoon[x]; > x++; > // Remove "//" from next line to show it a frame at a time. > // if(confirm('continue?')) > if(x==max) > { x=0; > // Swap max variables > maxtemp = max; max = maxnext; maxnext = maxtemp; How about: max+=maxnext;maxnext=max-maxnext;max-=maxnext; saves you a variable! (well known code for switching integers) > // Swap cartoon variables > temp = cartoon; cartoon = next; next = temp; > } > setTimeout("tick()", 100); // Change number here to change > speed > } > > cartoon = new FrameList( > ... add 1st half of frames here ..) > </script> > > <!-- MUST start new script tag --> > > <script language="JavaScript"> > next = new FrameList( > ... add 2nd half of frames here ..) > </script> > I have done this for that roller coaster animation (BTW, I downloaded > that and now I forget who made it.. could someone help me out? :), as > well as the complete revolving map, revolving earth, and the running > dog, and I'll update the other larger ones later. > > This javscript can be modified only slightly to include even larger > ones, for eg the running dog needs 5 variables. > > These can all be seen in the animation section here: > http://www.geocities.com/SouthBeach/Marina/4942/ascii.htm > > Regards, > J > > PS: I'll be including this ability in my next version of the animation > to hypertext converter (ie version 1.2). I posted a similar suggestion + sourcecode a while ago, but didn't get much response. You should take a look at: http://www.fmf.ml.org/~shimrod/asciiart/animation.html It features: * a choice of multiple animations * a statusbar showing speed and framenumber * buttons for: play, pause, stop, next frame, previous frame, play faster, play slower, reset, show as text The show as text button can easily be expanded to a show as HTML button, since HTML is just plain text too after all. This source could be expanded with the split animation source by adding a next field to every animation, thus making all the animations in a larger animation a circular singly linked list. Keep up the JS programming! BTW: you added NOSPAM to the front of your email adress, you should add it to the end. This way, the mail will still be sent to the server, and then back because the user is unknown, causing internet traffic, while the other way, the server doesn't exist so nothing will be sent. Greetz, -- (`. ____________________________ \ `. / __/ / / / /_ / /_ / ) `._..---._ \__ \ \ \ \_\ \ \ \ \_\ \ \`. __...---` o ) /___/_/_/_/_/ /_/_/_/___/___/ \ `._,--' , ___,' Herman Hiddema ---------------------- ) ,-._ \ ) _,-' ----------- mailto:shi...@fmf.ml.org /,' ``--.._____\/--'' http://fmf.ml.org/~shimrod ----------
About this thread.
These messages were posted publicly to the newsgroup
alt.ascii-art
in 1997 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.