Class Animation
Class Animation
Animation
- class Animation
- extends Panel
Class representing an animation. Each animation is a
series of frames of consistent and constant size that get
displayed for a fixed amount of time. There are two types of
animations, one-shot and looping. One-shot animations run
once, looping animations run continually until they are
stopped from outside.
-
FrameNumber
- This index indicates which frame of the animation will be displayed
next.
-
bOneShot
- If this animation runs only one, this gets set to true.
-
bRunning
- Is this animation actually animating now?
-
images
- The images comprising the stages of the animation.
-
Animation(Applet)
- Constructor - store the applet to call back to
-
Animation(Applet, AgentImage[], AgentFace)
- Create an animation that is not animating right now.
-
minimumSize()
- This method tells the LayoutManager the smallest size we
can be.
-
mouseDown(Event, int, int)
- Called if the user clicks the mouse in this Panel.
-
nextImage()
- Go to the next image.
-
paint(Graphics)
- Paint a single frame of this animation within an existing Graphics
context.
-
preferredSize()
- This method tells the LayoutManager the size we prefer
to be.
-
updateNextImage()
- Go to the next image and display it.
bRunning
public boolean bRunning
- Is this animation actually animating now?
images
public AgentImage images[]
- The images comprising the stages of the animation.
bOneShot
public boolean bOneShot
- If this animation runs only one, this gets set to true. If this
is a loop that restarts at the beginning, set this to false.
FrameNumber
public int FrameNumber
- This index indicates which frame of the animation will be displayed
next.
Animation
public Animation(Applet al)
- Constructor - store the applet to call back to
- Parameters:
- al - An applet to call back to.
Animation
public Animation(Applet al,
AgentImage im[],
AgentFace agf)
- Create an animation that is not animating right now.
minimumSize
public synchronized Dimension minimumSize()
- This method tells the LayoutManager the smallest size we
can be. In our case, it's the size of the image we're
displaying.
- Returns:
- A Dimension - width and height.
preferredSize
public synchronized Dimension preferredSize()
- This method tells the LayoutManager the size we prefer
to be. In our case, it's the size of the image we're
displaying.
- Returns:
- A Dimension - width and height.
paint
public void paint(Graphics g)
- Paint a single frame of this animation within an existing Graphics
context.
nextImage
public void nextImage()
- Go to the next image. Increments FrameNumber, rewinding
back to 0 if we've gone over the edge of the array.
updateNextImage
public void updateNextImage()
- Go to the next image and display it.
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Called if the user clicks the mouse in this Panel.
- Returns:
- false