|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.activities.PActivity
edu.umd.cs.piccolo.activities.PInterpolatingActivity
public class PInterpolatingActivity
PInterpolatingActivity interpolates between two states (source and destination) over the duration of the activity. The interpolation can be either linear or slow- in, slow-out.
The mode determines how the activity interpolates between the two states. The default mode interpolates from source to destination, but you can also go from destination to source, and from source to destination to source.
A loopCount of greater then one will make the activity reschedule itself when it has finished. This makes the activity loop between the two states.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.activities.PActivity |
---|
PActivity.PActivityDelegate |
Field Summary | |
---|---|
static int |
DESTINATION_TO_SOURCE
|
static int |
SOURCE_TO_DESTINATION
|
static int |
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 | |
---|---|
PInterpolatingActivity(long duration,
long stepRate)
|
|
PInterpolatingActivity(long duration,
long stepRate,
int loopCount,
int mode)
|
|
PInterpolatingActivity(long duration,
long stepRate,
long startTime,
int loopCount,
int mode)
Create a new PInterpolatingActivity. |
Method Summary | |
---|---|
protected void |
activityFinished()
This method is called after an activity is has finished running and the activity has been removed from the PActivityScheduler queue. |
protected void |
activityStarted()
This method is called right before an activity is scheduled to start running. |
protected void |
activityStep(long elapsedTime)
This is the method that most activities override to perform their behavior. |
float |
computeSlowInSlowOut(float zeroToOne)
|
boolean |
getFirstLoop()
Return true if the activity is executing its first loop. |
int |
getLoopCount()
Return the number of times the activity should automatically reschedule itself after it has finished. |
int |
getMode()
Return the mode that defines how the activity interpolates between states. |
boolean |
getSlowInSlowOut()
|
protected java.lang.String |
paramString()
Returns a string representing the state of this node. |
void |
setDuration(long aDuration)
Set the amount of time that this activity should take to complete, after the startStepping method is called. |
void |
setFirstLoop(boolean firstLoop)
Set if the activity is executing its first loop. |
void |
setLoopCount(int loopCount)
Set the number of times the activity should automatically reschedule itself after it has finished. |
void |
setMode(int mode)
Set the mode that defines how the activity interpolates between states. |
void |
setRelativeTargetValue(float zeroToOne)
Subclasses should override this method and set the value on their target (the object that they are modifying) accordingly. |
protected void |
setRelativeTargetValueAdjustingForMode(float zeroToOne)
|
void |
setSlowInSlowOut(boolean isSlowInSlowOut)
|
void |
terminate()
Stop this activity immediately, and remove it from the activity scheduler. |
Methods inherited from class edu.umd.cs.piccolo.activities.PActivity |
---|
getActivityScheduler, getDelegate, getDuration, getNextStepTime, getStartTime, getStepRate, getStopTime, isAnimation, isStepping, processStep, setActivityScheduler, setDelegate, setStartTime, setStepRate, startAfter, terminate, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SOURCE_TO_DESTINATION
public static final int DESTINATION_TO_SOURCE
public static final int SOURCE_TO_DESTINATION_TO_SOURCE
Constructor Detail |
---|
public PInterpolatingActivity(long duration, long stepRate)
public PInterpolatingActivity(long duration, long stepRate, int loopCount, int mode)
public PInterpolatingActivity(long duration, long stepRate, long startTime, int loopCount, int mode)
duration
- the length of one loop of the activitystepRate
- the amount of time between steps of the activitystartTime
- the time (relative to System.currentTimeMillis()) that
this activity should start.loopCount
- number of times the activity should reschedule itselfmode
- defines how the activity interpolates between statesMethod Detail |
---|
public void setDuration(long aDuration)
setDuration
in class PActivity
public int getMode()
public void setMode(int mode)
public int getLoopCount()
public void setLoopCount(int loopCount)
public boolean getFirstLoop()
public void setFirstLoop(boolean firstLoop)
public boolean getSlowInSlowOut()
public void setSlowInSlowOut(boolean isSlowInSlowOut)
protected void activityStarted()
PActivity
activityStarted
in class PActivity
protected void activityStep(long elapsedTime)
PActivity
activityStep
in class PActivity
elapsedTime
- the amount of time that has passed relative to the activities startTime.protected void activityFinished()
PActivity
activityFinished
in class PActivity
public void terminate()
terminate
in class PActivity
public void setRelativeTargetValue(float zeroToOne)
public float computeSlowInSlowOut(float zeroToOne)
protected void setRelativeTargetValueAdjustingForMode(float zeroToOne)
protected java.lang.String paramString()
null
.
paramString
in class PActivity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |