visual.dynamic.described
Class DescribedSprite

java.lang.Object
  extended by visual.dynamic.described.AbstractSprite
      extended by visual.dynamic.described.TweeningSprite
          extended by visual.dynamic.described.DescribedSprite
All Implemented Interfaces:
MetronomeListener, Sprite, SimpleContent, TransformableContent

public class DescribedSprite
extends TweeningSprite

A TweeningSprite that uses described visual content Note: This class uses a Vector of AggregateContent objects rather than CompositeContent objects for simplicity.

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Field Summary
 
Fields inherited from class visual.dynamic.described.TweeningSprite
keyTimes, locations, REMAIN, REMOVE, rotations, scalings
 
Fields inherited from class visual.dynamic.described.AbstractSprite
angle, rotationPoint, rotationX, rotationY, scaleX, scaleY, visible, x, y
 
Constructor Summary
DescribedSprite()
          Default Constructor
 
Method Summary
 void addKeyTime(int keyTime, java.awt.geom.Point2D location, java.lang.Double rotation, java.lang.Double scaling, AggregateContent ctc)
          Add a key time Note: This method does not ensure that the first key time actually contains static visual content
 TransformableContent getContent()
          Get the visual content associated with this Sprite Note that the visual content created depends on the current state of this Sprite
protected  void tweenShape(AggregateContent a, AggregateContent b, double frac)
          Determine the current 'tweened shape
 
Methods inherited from class visual.dynamic.described.TweeningSprite
addKeyTime, getInterpolationFraction, getKeyTimeIndex, getNextKeyTimeIndex, handleTick, initialize, reinitialize, setEndState, tweenLocation, tweenRotation, tweenScaling
 
Methods inherited from class visual.dynamic.described.AbstractSprite
getBounds2D, getBounds2D, intersects, render, setLocation, setRotation, setRotation, setScale, setScale, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescribedSprite

public DescribedSprite()
Default Constructor

Method Detail

addKeyTime

public void addKeyTime(int keyTime,
                       java.awt.geom.Point2D location,
                       java.lang.Double rotation,
                       java.lang.Double scaling,
                       AggregateContent ctc)
Add a key time Note: This method does not ensure that the first key time actually contains static visual content

Parameters:
keyTime - The time
location - The location of the sprite at this time
rotation - The rotation of the sprite (null to align with path)
scaling - The scaling of the sprite at this time
ctc - The Content to use (or null to use previous Content)

getContent

public TransformableContent getContent()
Get the visual content associated with this Sprite Note that the visual content created depends on the current state of this Sprite

Specified by:
getContent in class AbstractSprite
Returns:
The transformed content

tweenShape

protected void tweenShape(AggregateContent a,
                          AggregateContent b,
                          double frac)
Determine the current 'tweened shape

Parameters:
a - The first shape
b - The second shape
frac - The interpolation fraction


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers