edu.umd.cs.piccolo.activities
Class PTransformActivity

java.lang.Object
  extended by edu.umd.cs.piccolo.activities.PActivity
      extended by edu.umd.cs.piccolo.activities.PInterpolatingActivity
          extended by edu.umd.cs.piccolo.activities.PTransformActivity

public class PTransformActivity
extends PInterpolatingActivity

PTransformActivity interpolates between two transforms setting its target's transform as it goes. See PNode. animate*() for an example of this activity in used. The source transform is retrieved from the target just before the animation is scheduled to start.

Version:
1.0
Author:
Jesse Grosjean

Nested Class Summary
static interface PTransformActivity.Target
          Target Objects that want to get transformed by the transform activity must implement this interface.
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.activities.PActivity
PActivity.PActivityDelegate
 
Field Summary
 
Fields inherited from class edu.umd.cs.piccolo.activities.PInterpolatingActivity
DESTINATION_TO_SOURCE, SOURCE_TO_DESTINATION, SOURCE_TO_DESTINATION_TO_SOURCE
 
Fields inherited from class edu.umd.cs.piccolo.activities.PActivity
TERMINATE_AND_FINISH, TERMINATE_AND_FINISH_IF_STEPPING, TERMINATE_WITHOUT_FINISHING
 
Constructor Summary
PTransformActivity(long duration, long stepRate, int loopCount, int mode, PTransformActivity.Target aTarget, java.awt.geom.AffineTransform aDestination)
          Create a new PTransformActivity.
PTransformActivity(long duration, long stepRate, PTransformActivity.Target aTarget)
           
PTransformActivity(long duration, long stepRate, PTransformActivity.Target aTarget, java.awt.geom.AffineTransform aDestination)
           
 
Method Summary
protected  void activityStarted()
          Called when activity is started.
 double[] getDestinationTransform()
          Return the final transform that will be set on the transform activities target when the transform activity stops stepping.
protected  boolean isAnimation()
          Return true if this activity is performing an animation.
 void setDestinationTransform(double[] newDestination)
          Set the final transform that will be set on the transform activities target when the transform activity stops stepping.
 void setRelativeTargetValue(float zeroToOne)
          Subclasses should override this method and set the value on their target (the object that they are modifying) accordingly.
 
Methods inherited from class edu.umd.cs.piccolo.activities.PInterpolatingActivity
activityFinished, activityStep, computeSlowInSlowOut, getFirstLoop, getLoopCount, getMode, getSlowInSlowOut, setDuration, setFirstLoop, setLoopCount, setMode, setRelativeTargetValueAdjustingForMode, setSlowInSlowOut, terminate
 
Methods inherited from class edu.umd.cs.piccolo.activities.PActivity
getActivityScheduler, getDelegate, getDuration, getNextStepTime, getStartTime, getStepRate, getStopTime, isStepping, paramString, processStep, setActivityScheduler, setDelegate, setStartTime, setStepRate, startAfter, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PTransformActivity

public PTransformActivity(long duration,
                          long stepRate,
                          PTransformActivity.Target aTarget)

PTransformActivity

public PTransformActivity(long duration,
                          long stepRate,
                          PTransformActivity.Target aTarget,
                          java.awt.geom.AffineTransform aDestination)

PTransformActivity

public PTransformActivity(long duration,
                          long stepRate,
                          int loopCount,
                          int mode,
                          PTransformActivity.Target aTarget,
                          java.awt.geom.AffineTransform aDestination)
Create a new PTransformActivity.

Parameters:
duration - the length of one loop of the activity
stepRate - the amount of time between steps of the activity
loopCount - number of times the activity should reschedule itself
mode - defines how the activity interpolates between states
aTarget - the object that the activity will be applied to and where the source state will be taken from.
aDestination - the destination color state
Method Detail

isAnimation

protected boolean isAnimation()
Description copied from class: PActivity
Return true if this activity is performing an animation. This is used by the PCanvas to determine if it should set the render quality to PCanvas.animatingRenderQuality or not for each frame it renders.

Overrides:
isAnimation in class PActivity
Returns:
whether this activity is an animation, subclasses can override this.

getDestinationTransform

public double[] getDestinationTransform()
Return the final transform that will be set on the transform activities target when the transform activity stops stepping.


setDestinationTransform

public void setDestinationTransform(double[] newDestination)
Set the final transform that will be set on the transform activities target when the transform activity stops stepping.


activityStarted

protected void activityStarted()
Description copied from class: PInterpolatingActivity
Called when activity is started. Makes sure target value is set properly for start of activity.

Overrides:
activityStarted in class PInterpolatingActivity

setRelativeTargetValue

public void setRelativeTargetValue(float zeroToOne)
Description copied from class: PInterpolatingActivity
Subclasses should override this method and set the value on their target (the object that they are modifying) accordingly.

Overrides:
setRelativeTargetValue in class PInterpolatingActivity


Copyright © 1995-2009 Piccolo2D. All Rights Reserved.