public class PColorActivity extends PInterpolatingActivity
Modifier and Type | Class and Description |
---|---|
static interface |
PColorActivity.Target
Target Objects that want their color to be set by the color
activity must implement this interface.
|
PActivity.PActivityDelegate
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 |
---|
PColorActivity(long duration,
long stepRate,
int loopCount,
int mode,
PColorActivity.Target aTarget,
Color aDestination)
Create a new PColorActivity.
|
PColorActivity(long duration,
long stepRate,
PColorActivity.Target aTarget)
Constructs a color activity for the given target that will animate for
the duration provided at an interval of stepRate.
|
PColorActivity(long duration,
long stepRate,
PColorActivity.Target aTarget,
Color aDestination)
Constructs a color activity for the given target that will animate for
the duration provided at an interval of stepRate from the target's
starting color to the destination color.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activityStarted()
Overrides it's parent to ensure that the source color is the color of the
node being animated.
|
Color |
getDestinationColor()
Return the final color that will be set on the color activities target
when the activity stops stepping.
|
protected boolean |
isAnimation()
Returns true since all PColorActivities animate the scene.
|
void |
setDestinationColor(Color newDestination)
Set the final color that will be set on the color activities target when
the activity stops stepping.
|
void |
setRelativeTargetValue(float zeroToOne)
Interpolates the target node's color by mixing the source color and the
destination color.
|
activityFinished, 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
public PColorActivity(long duration, long stepRate, PColorActivity.Target aTarget)
duration
- duration in milliseconds that the animation should laststepRate
- the time between interpolationsaTarget
- the target onto which the animation is being performedpublic PColorActivity(long duration, long stepRate, PColorActivity.Target aTarget, Color aDestination)
duration
- duration in milliseconds that the animation should laststepRate
- the time between interpolationsaTarget
- the target onto which the animation is being performedaDestination
- the color to which the animation is aiming atpublic PColorActivity(long duration, long stepRate, int loopCount, int mode, PColorActivity.Target aTarget, Color aDestination)
duration
- the length of one loop of the activitystepRate
- the amount of time between steps of the activityloopCount
- number of times the activity should reschedule itselfmode
- defines how the activity interpolates between statesaTarget
- the object that the activity will be applied to and where
the source state will be taken from.aDestination
- the destination color stateprotected boolean isAnimation()
isAnimation
in class PActivity
public Color getDestinationColor()
public void setDestinationColor(Color newDestination)
newDestination
- to animate towardsprotected void activityStarted()
activityStarted
in class PInterpolatingActivity
public void setRelativeTargetValue(float zeroToOne)
setRelativeTargetValue
in class PInterpolatingActivity
zeroToOne
- 0 = all source color, 1 = all destination colorCopyright © 1995-2013 Piccolo2D. All Rights Reserved.