public class PPositionPathActivity extends PPathActivity
Modifier and Type | Class and Description |
---|---|
static interface |
PPositionPathActivity.Target
Interface that objects must conform to in order to have their position
animated.
|
PActivity.PActivityDelegate
Modifier and Type | Field and Description |
---|---|
protected Point2D[] |
positions
Points that define the animation's path.
|
protected PPositionPathActivity.Target |
target
An abstract representation of the thing being positioned.
|
knots
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 |
---|
PPositionPathActivity(long duration,
long stepRate,
int loopCount,
int mode,
PPositionPathActivity.Target target,
float[] knots,
Point2D[] positions)
Constructs a position activity that will repeat the number of times
specified.
|
PPositionPathActivity(long duration,
long stepRate,
PPositionPathActivity.Target target)
Constructs a position activity that acts on the given target for the
duration provided and will update it's position at the given stepRate.
|
PPositionPathActivity(long duration,
long stepRate,
PPositionPathActivity.Target target,
float[] knots,
Point2D[] positions)
Constructs a position activity that acts on the given target for the
duration provided and will update it's position at the given stepRate.
|
Modifier and Type | Method and Description |
---|---|
Point2D |
getPosition(int index)
Returns the point at the given index.
|
Point2D[] |
getPositions()
Returns a copy of the path's points.
|
protected boolean |
isAnimation()
Returns true since this activity modifies the view and so cause a
repaint.
|
void |
setPosition(int index,
Point2D position)
Sets the position of the point at the given index.
|
void |
setPositions(GeneralPath path)
Extracts positions from a GeneralPath and uses them to define this
activity's animation points.
|
void |
setPositions(Point2D[] positions)
Changes all positions that define where along the target is being
positioned during the animation.
|
void |
setRelativeTargetValue(float zeroToOne,
int startKnot,
int endKnot)
Overridden to interpret position at correct point along animation.
|
getKnot, getKnots, getKnotsLength, setKnot, setKnots, setRelativeTargetValue
activityFinished, activityStarted, activityStep, computeSlowInSlowOut, getFirstLoop, getLoopCount, getMode, getSlowInSlowOut, setDuration, setFirstLoop, setLoopCount, setMode, setRelativeTargetValueAdjustingForMode, setSlowInSlowOut, terminate
getActivityScheduler, getDelegate, getDuration, getNextStepTime, getStartTime, getStepRate, getStopTime, isStepping, paramString, processStep, setActivityScheduler, setDelegate, setStartTime, setStepRate, startAfter, terminate
protected Point2D[] positions
protected PPositionPathActivity.Target target
public PPositionPathActivity(long duration, long stepRate, PPositionPathActivity.Target target)
duration
- milliseconds of animationstepRate
- milliseconds between successive position updatestarget
- abstract representation of thing being animatedpublic PPositionPathActivity(long duration, long stepRate, PPositionPathActivity.Target target, float[] knots, Point2D[] positions)
duration
- milliseconds of animationstepRate
- milliseconds between successive position updatestarget
- abstract representation of thing being animatedknots
- timing to use when animatingpositions
- points along the pathpublic PPositionPathActivity(long duration, long stepRate, int loopCount, int mode, PPositionPathActivity.Target target, float[] knots, Point2D[] positions)
duration
- milliseconds of animationstepRate
- milliseconds between successive position updatesloopCount
- number of times this activity should repeatmode
- how easing is handled on this activitytarget
- abstract representation of thing being animatedknots
- timing to use when animatingpositions
- points along the pathprotected boolean isAnimation()
isAnimation
in class PActivity
public Point2D[] getPositions()
public Point2D getPosition(int index)
index
- desired position indexpublic void setPositions(Point2D[] positions)
positions
- new animation positionspublic void setPosition(int index, Point2D position)
index
- index of the point to changeposition
- point defining the new positionpublic void setPositions(GeneralPath path)
path
- source of pointspublic void setRelativeTargetValue(float zeroToOne, int startKnot, int endKnot)
setRelativeTargetValue
in class PPathActivity
zeroToOne
- how far along the activity we arestartKnot
- the index of the startKnotendKnot
- the index of the endKnotCopyright © 1995-2012 Piccolo2D. All Rights Reserved.