public abstract class PPathActivity extends PInterpolatingActivity
Knots are used to determine when in time the activity should move from state to state. Knot values should be increasing in value from 0 to 1 inclusive. This class is based on the Java 3D PathInterpolator object, see that class documentation for more information on the basic concepts used in this classes design.
See PPositionPathActivity for a concrete path activity that will animate through a list of points.
PActivity.PActivityDelegate
Modifier and Type | Field and Description |
---|---|
protected float[] |
knots
The "knots" that define this path's activity timing through its activity
and should be an monotonously increasing array starting where each value
is >=0 and ending at 1f.
|
DESTINATION_TO_SOURCE, SOURCE_TO_DESTINATION, SOURCE_TO_DESTINATION_TO_SOURCE
TERMINATE_AND_FINISH, TERMINATE_AND_FINISH_IF_STEPPING, TERMINATE_WITHOUT_FINISHING
Constructor and Description |
---|
PPathActivity(long duration,
long stepRate,
float[] knots)
Constructs a PPathActivity that will last the specified duration, will
animate every stepRate and will progress according to the knots provided.
|
PPathActivity(long duration,
long stepRate,
int loopCount,
int mode,
float[] knots)
Constructs a PPathActivity that will repeat the specified number of
times, last the specified duration, will animate every stepRate and will
progress according to the knots provided.
|
Modifier and Type | Method and Description |
---|---|
float |
getKnot(int index)
Returns the value of the knot at the given index.
|
float[] |
getKnots()
Return the knots that define the timing of this activity.
|
int |
getKnotsLength()
Returns the number of knots that define the timing of this activity.
|
void |
setKnot(int index,
float knot)
Changes the knot at the given index.
|
void |
setKnots(float[] newKnots)
Changes the knots that define the timing of this activity.
|
void |
setRelativeTargetValue(float zeroToOne)
Sets the target's value taking knot timing into account.
|
abstract void |
setRelativeTargetValue(float zeroToOne,
int startKnot,
int endKnot)
An abstract method that allows subclasses to define what target value
matches the given progress and knots.
|
activityFinished, activityStarted, activityStep, computeSlowInSlowOut, getFirstLoop, getLoopCount, getMode, getSlowInSlowOut, setDuration, setFirstLoop, setLoopCount, setMode, setRelativeTargetValueAdjustingForMode, setSlowInSlowOut, terminate
getActivityScheduler, getDelegate, getDuration, getNextStepTime, getStartTime, getStepRate, getStopTime, isAnimation, isStepping, paramString, processStep, setActivityScheduler, setDelegate, setStartTime, setStepRate, startAfter, terminate
protected float[] knots
public PPathActivity(long duration, long stepRate, float[] knots)
duration
- duration in milliseconds that this activity should laststepRate
- interval in milliseconds between animation stepsknots
- array defining the speed of the animation alongs it's
animationpublic PPathActivity(long duration, long stepRate, int loopCount, int mode, float[] knots)
duration
- duration in milliseconds that this activity should laststepRate
- interval in milliseconds between animation stepsknots
- array defining the speed of the animation alongs it's
animationloopCount
- # of times activity should repeatmode
- controls easing of the activitypublic int getKnotsLength()
public void setKnots(float[] newKnots)
newKnots
- the new knots to assign to this activitypublic float[] getKnots()
public void setKnot(int index, float knot)
index
- index of knot to changeknot
- new value to assign to the knotpublic float getKnot(int index)
index
- index of desired knotpublic void setRelativeTargetValue(float zeroToOne)
setRelativeTargetValue
in class PInterpolatingActivity
zeroToOne
- how much of this activity has elapsed 0=none,
1=completedpublic abstract void setRelativeTargetValue(float zeroToOne, int startKnot, int endKnot)
zeroToOne
- how far between the knots the activity isstartKnot
- knot that defines the start of this particular interpolationendKnot
- knot that defines the end of this particular interpolationCopyright © 1995–2013 Piccolo2D. All rights reserved.