Description

This applet animates juggling patterns that are given to it in the popular site swap juggling notation. You give it a pattern string as well as the physical parameters describing the juggler and his world (acceleration of gravity in meters/second^2, throws per second, etc.), and the applet will animate the pattern in as realistic a manner as possible. By this I mean that, while the pattern is of course scaled down in size to fit on the screen, the physical aspect ratio of the pattern as well as the timing of the throws is realistic. (Actually the timing can be globally scaled using the slowdown parameter discussed below, but this doesn't disturb the appearance of the pattern.)

One of my goals when creating this applet (beyond that of learning Java) was to make it as general-purpose as possible. In the near future I will be adding support for bounce juggling and possibly passing. If you think of any nifty features to add, feel free to email me at jboyce@physics.berkeley.edu. I have been thinking about converting my site swap-generating program J2 to Java and teaching it how to talk with the animation applet.

This applet has only been tested by me on a Power Mac, using Sun's JDK 1.0.2 and a beta version of Netscape 3.0. If there are any problems on other machines (or some other Java programmers want to give me some programming tips), please email me with them.

Applet Calling Syntax

The full form of the applet call is shown below. There are two required parameters: one indicating a mode, the other indicating the pattern to animate. The remaining parameters marked with asterisks are optional, in which case the default values are shown). The line break below just separates the animation parameters from the physical parameters, and is not a necessary part of the calling syntax.


<APPLET codebase=JuggleAnim code=JuggleAnim.class width=150 height=200>

<PARAM name = mode          value = "siteswap">
<PARAM name = pattern       value = "5"       >
<PARAM name = border        value = "0"       >   *
<PARAM name = slowdown      value = "1.0"     >   *
<PARAM name = fps           value = "10.0"    >   *
<PARAM name = startpaused   value = "true"    >   *
<PARAM name = dbuffer       value = "true"    >   *
<PARAM name = imagebase     value = ""        >   *
<PARAM name = ballpic       value = "ball.gif">   *

<PARAM name = g             value = "9.8"     >   *
<PARAM name = tps           value = "4.5"     >   *
<PARAM name = throwx        value = "0.25"    >   *
<PARAM name = rightthrowx   value = "0.25"    >   *
<PARAM name = leftthrowx    value = "-0.25"   >   *
<PARAM name = catchx        value = "0.5"     >   *
<PARAM name = rightcatchx   value = "0.5"     >   *
<PARAM name = leftcatchx    value = "-0.5"    >   *
<PARAM name = balldiam      value = "0.1"     >   *
<PARAM name = bouncefrac    value = "0.9"     >   *
<PARAM name = handscoop     value = "-0.2"    >   *
<PARAM name = dwell         value = "1.0"     >   *

</APPLET>

These parameters are described in more detail below.

Required Parameters

mode
The animation mode, currently must be set to either siteswap or syncsiteswap.
pattern
Pattern to animate, in either site swap or sync site swap notation, depending on the mode setting.

Animation Parameters

border
Size of border around juggling pattern, in pixels. (optional)
slowdown
Factor by which to slow down time. (optional)
fps
Frames per second on the screen. (optional)
startpaused
Should the animation start paused? (optional)
dbuffer
Should the animator double-buffer to improve quality, at the expense of increased memory usage? (optional)
imagebase
Directory from which to load images. (optional)
ballpic
Name of picture to use as the ball. Feel free to be really creative here. If this parameter is not specified the applet will create its own ball image using the balldiam parameter below. (optional)

Physical Parameters

g
Acceleration of gravity, in meters per second per second. (optional)
tps
Throws per second made by juggler. (optional)
throwx
Throwing position from centerline of body for both hands, in meters. (optional)
rightthrowx
Throwing position for right hand only, overrides throwx above. (optional)
leftthrowx
As above, for the left hand. This will usually be a negative number, in meters. (optional)
catchx
Catching position from centerline of body for both hands, in meters. (optional)
rightcatchx
Catching position for right hand only, overrides catchx above. (optional)
leftcatchx
As above, for the left hand. This will typically be a negative number. (optional)
balldiam
Ball diameter, in meters. This is used only if the user does not specify a ball image to load using ballpic above. (optional)
bouncefrac
Fraction of a ball's energy retained after bouncing off the ground (how much of its dropped height does it return to?). (optional)
handscoop
Distance in meters below catch/throw position that balls are "scooped" to on the carry. Negative numbers mean to scoop down. (optional)
dwell
Time (in throw units) that a caught ball spends in a hand. A dwell of 1.0 means that each hand is full half the time. (optional)

Pattern Input Format

The applet uses regular site swap juggling notation for its input, with a few changes:

  • The input is case-sensitive. Lower-case letters are used for throw values ('a'=10, etc.). Upper-case is used for throw modifiers, which come after the throw they modify.

  • A lower-case letter is always a throw value, with the exception of the letter 'x', which denotes crossing throws in syncsiteswap mode.

  • You should not use any spaces in the input string.

  • There are currently two recognized throw modifiers:
    B
    Lift-bounce the preceding throw. If this is not possible, do a force-bounce instead (you can't lift-bounce 1's when juggling at a normal pace, for example).
    F
    Force-bounce the preceding throw.
    When in doubt, look at the pattern HTML pages I've written.

    Experimental Features

    There are three additional parameters that the program looks for; the intended purpose of these is to emulate the pattern input format used by Ken Matsuoka's JuggleMaster program. The problem is that my juggler's hands don't move in quite the same way (particularly when there is a hold), so some patterns look odd. Anyway, if you want to fool around with it the parameters are:

    <PARAM name = mat_style     value = "{13,0}{4,0}">   *
    <PARAM name = mat_DR        value = "0.5"        >   *
    <PARAM name = mat_HR        value = "0.2"        >   *
    
    If the mat_style parameter is specified (which tells the hands how to move), then the catchx and throwx parameters listed above are ignored. Similarly, the mat_DR and mat_HR override the dwell and tps parameters, respectively. The values shown above are not defaults but just show "common" values. You can obtain these parameters by looking in the patt_e.jm file that comes with JuggleMaster. As an example, look at the Mills' Mess pattern from JuggleMaster.