The Animator Applet The Animator applet is a general purpose animation tool. The current version, v1.8, has these features: you can specify an order to the frames, which lets you reuse them you can specify whether the animation repeats you can specify a soundtrack you can specify sounds to be played with individual frames you can specify the amount of time to pause between frames (both on the animation as a whole and on individual frames) you can specify a startup image to display while loading you can specify a background image or color upon which to display the animation you can specify a position at which to display each frame you can specify the URL of a page to visit when the user clicks on the animation you can view the applet's parameters at runtime Please try out the Animator applet for your own animations and let us know what you think. Here's the source code. You can save it by bringing up the View Source window for it, and clicking the Save button. Then compile it (with javac, the Java compiler) and try it out. Or grab all of the .class files here: Animator.class, ParseException.class, and DescriptionFrame.class. The Animator applet isn't finished -- we plan to add more features -- but we'd appreciate your suggestions. Send bug reports and feature requests to java@java.sun.com. You can get a bunch of information about Animator by pressing the SHIFT key while clicking the mouse in an Animation. Tag Syntax -- the height (in pixels) of the tallest frame -- the directory that has the animation frames (a series of pictures in GIF or JPEG format, by default named T1.gif, T2.gif, ...) -- an image to display at load time -- an image to paint the frames against -- a solid color to paint the frames against -- number of the starting frame (1..n) -- number of the end frame (1..n) -- milliseconds to pause between images default - can be overridden by PAUSES) -- millisecond delay per frame. Blank uses default PAUSE value -- repeat the sequence? -- positions (X@Y) for each frame. Blank means use previous frame's position -- explicit order for frames - see below -- the directory that has the audio files -- an audio file to play throughout -- audio files keyed to individual frames -- The URL of the page to visit when user clicks on the animation (if not set, click pauses/resumes the animation) The IMAGES, STARTIMAGE, ENDIMAGE, and NAMEPATTERN parameters You can specify either an IMAGES list or a STARTIMAGE/ENDIMAGE range, but not both. The IMAGES list is a string of frame numbers in the order in which you wish them to display, separated by vertical bars. You can use NAMEPATTERN with IMAGES or STARTIMAGE/ENDIMAGE to generate the file names to use. STARTIMAGE and ENDIMAGE let you specify a range of images. Specifying an ENDIMAGE that is numerically less than the STARTIMAGE will display the images in reverse order. Both parameters have default values of 1, so specifying only STARTIMAGE="15" means "play the frames in reverse order from 15 to 1." Saying only ENDIMAGE="13" means "play the frames from 1 to 13." Of course, you can use both STARTIMAGE and ENDIMAGE together. NAMEPATTERN lets you specify how to generate the names of the files in the range STARTIMAGE to ENDIMAGE. The pattern is like a URL with substitution. Any instance of the characters '%N' will have the current index (integer in the STARTIMAGE..ENDIMAGE range) substituted for it; any instance of '%[digit]' -- for example, '%5' -- will have the index plugged in, left-padded with zeroes. Finally, '%%' substitutes a single '%'. Some examples (all assume STARTIMAGE = 1 and ENDIMAGE = 10): NAMEPATTERN = "T%N.gif" This is the default pattern, and will generate the names T1.gif, T2.gif, ...T10.gif. NAMEPATTERN = "anim%3/anim%3.jpg" This will generate the names anim001/anim001.jpg, ... anim010/anim010.jpg NAMEPATTERN = "100%%frame%N.jpg" This will generate the names 100%frame1.jpg, 100%frame2.jpg, etc. Example files example1.html Java beans, with a soundtrack and per-frame sound effects. example2.html A simple two-frame animation. example3.html A simple beany animation with start-up image. example4.html Java beans with POSITIONS, HREF, and BACKGROUNDCOLOR. Herb Jellinek | jellinek@eng.sun.com