kinetic.util
Class KTEngine

java.lang.Object
  |
  +--kinetic.util.KTEngine
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class KTEngine
extends java.lang.Object
implements java.lang.Runnable, java.io.Serializable

Utiltiy class that implements an animation thread that takes aniamtion sequence and will draw double buffered images to the screen. The animation can be stop, reset, or set to a specific time. This drawing thread also supports motion blur if the processing power if available in real time to support it.

See Also:
Serialized Form

Field Summary
 boolean antialiasing
          anti aliasing flag for drawing, can be turned off to boost performance
 
Constructor Summary
KTEngine()
          Creates a new instance of KTEngine
 
Method Summary
 void buildAnimation()
          builds the animation with the sequence builder associated with the engine
 void draw(double time)
          renders the animation at a specified time on the current canvas
 double getLastTime()
          gets the position of the playback head the last time the animation thread was called.
 kinetic.Sequence getSequence()
          returns the animation sequence associated with the engine
 boolean isRunning()
          check to see if the animation is still running
 void resetAnimationTime()
          reset the animation time to 0ms
 void run()
          start the animation thread fro the last given animation time
 void setAnimationTime(double t)
          sets the animation time of the engine
 void setKTEngineEventListener(kinetic.util.KTEngineEventListener newEventListener)
          sets an event listener that can respond to event generated by the engine
 void setMotionBlur(int blur)
          set the motion blur (assumes default values for other parameters)
 void setMotionBlur(int blur, double shutterAngle, double shutterPhase)
          sets the motion blur value
 void setSequence(kinetic.Sequence seq)
          sets the animation sequence associated with the engine
 void setSequenceBuilder(kinetic.util.SequenceBuilder b)
          sets the sequence builder associated with the engine.
 void setStage(java.awt.Component newStage)
          set the drawing canvas for the engine
 void start()
          starts the animation thread from time 0ms
 void stop()
          stops the animation thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

antialiasing

public boolean antialiasing
anti aliasing flag for drawing, can be turned off to boost performance

Constructor Detail

KTEngine

public KTEngine()
Creates a new instance of KTEngine

Method Detail

setMotionBlur

public void setMotionBlur(int blur,
                          double shutterAngle,
                          double shutterPhase)
sets the motion blur value

Parameters:
blur - number of temporally super sampled images to render per frame
shutterAngle - portion of the time step to take the super sampled images from. 360 degrees means the shutter never closes.
shutterPhase - position of the portion of the timestep for taking the super sampled images. 0-360 degrees.

setMotionBlur

public void setMotionBlur(int blur)
set the motion blur (assumes default values for other parameters)

Parameters:
blur - number of temporally super sampled images to render per frame

run

public void run()
start the animation thread fro the last given animation time

Specified by:
run in interface java.lang.Runnable

start

public void start()
starts the animation thread from time 0ms


stop

public void stop()
stops the animation thread


isRunning

public boolean isRunning()
check to see if the animation is still running

Returns:
boolean flag if the animation thread is currently running

setAnimationTime

public void setAnimationTime(double t)
sets the animation time of the engine

Parameters:
t - the desired aniamtione time (ms)

resetAnimationTime

public void resetAnimationTime()
reset the animation time to 0ms


getLastTime

public double getLastTime()
gets the position of the playback head the last time the animation thread was called.

Returns:
position of the play head (ms)

setStage

public void setStage(java.awt.Component newStage)
set the drawing canvas for the engine

Parameters:
newStage - a AWT component that will be used as the drawing canvas for the animation

draw

public void draw(double time)
renders the animation at a specified time on the current canvas

Parameters:
time - position of the play head in the animation

setKTEngineEventListener

public void setKTEngineEventListener(kinetic.util.KTEngineEventListener newEventListener)
sets an event listener that can respond to event generated by the engine

Parameters:
newEventListener - an engine event listener

getSequence

public kinetic.Sequence getSequence()
returns the animation sequence associated with the engine

Returns:
animation sequence

setSequence

public void setSequence(kinetic.Sequence seq)
sets the animation sequence associated with the engine

Parameters:
seq - animation sequence

setSequenceBuilder

public void setSequenceBuilder(kinetic.util.SequenceBuilder b)
sets the sequence builder associated with the engine. Utility function or easily inserting programmatically defined animations

Parameters:
b - sequence builder

buildAnimation

public void buildAnimation()
builds the animation with the sequence builder associated with the engine