public class ParticleSystemActivity
extends org.piccolo2d.activities.PActivity
| Constructor and Description |
|---|
ParticleSystemActivity(long duration)
Create a new particle system activity with the specified duration in milliseconds.
|
ParticleSystemActivity(long duration,
long stepRate,
long startTime)
Create a new particle system activity with the specified duration, step rate, and start time in milliseconds.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activityFinished() |
protected void |
activityStep(long elapsedTime) |
void |
clamp(org.piccolo2d.PNode node)
Clamp the velocity for the particle associated with the specified node
to
[0.0f, 0.0f]. |
void |
createAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength,
float minimumDistance)
Create a new attraction (or repulsion) force between the specified source and target
nodes with the specified strength and minimum distance.
|
void |
createParticle(org.piccolo2d.PNode node,
float mass)
Create a new particle for the specified node with the specified mass.
|
void |
createSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength,
float damping,
float restLength)
Create a new spring between the specified source and target nodes with the
specified strength, damping factor, and rest length.
|
void |
disableAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Disable the attraction between the specified source and target nodes.
|
void |
disableSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Disable the spring between the specified source and target nodes.
|
void |
enableAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Enable the attraction between the specified source and target nodes.
|
void |
enableSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Enable the spring between the specified source and target nodes.
|
float |
getAttractionMinimumDistance(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Return the minimum distance for the attraction between the specified source and target nodes.
|
float |
getAttractionStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Return the strength of the attraction between the specified source and target nodes.
|
float |
getParticleMass(org.piccolo2d.PNode node)
Return the mass of the particle associated with the specified node.
|
float |
getSpringDamping(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Return the damping factor for the spring between the specified source and target nodes.
|
float |
getSpringRestLength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Return the rest length for the spring between the specified source and target nodes.
|
float |
getSpringStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
Return the strength of the spring between the specified source and target nodes.
|
Point2D |
getVelocity(org.piccolo2d.PNode node)
Return the velocity for particle associated with the specified node.
|
Point2D |
getVelocity(org.piccolo2d.PNode node,
Point2D velocity)
Return the specified velocity, set to the velocity for particle associated with the specified node.
|
void |
release(org.piccolo2d.PNode node)
Release or unclamp the velocity for the particle associated with the specified node.
|
void |
setAttractionMinimumDistance(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float minimumDistance)
Set the minimum distance for the attraction between the specified source and target nodes
to
minimumDistance. |
void |
setAttractionStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength)
Set the strength of the attraction between the specified source and target nodes to
strength. |
void |
setDrag(float drag)
Set the drag force for the particle system to
drag. |
void |
setGravity(float gravity)
Set the strength of gravity for the particle system to
gravity. |
void |
setParticleMass(org.piccolo2d.PNode node,
float mass)
Set the mass of the particle associated with the specified node to
mass. |
void |
setSpringDamping(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float damping)
Set the damping factor for the spring between the specified source and target nodes to
dampingFactor. |
void |
setSpringRestLength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float restLength)
Set the rest length for the spring between the specified source and target nodes to
restLength. |
void |
setSpringStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength)
Set the strength of the spring between the specified source and target nodes to
strength. |
void |
setVelocity(org.piccolo2d.PNode node,
float x,
float y)
Set the velocity for the particle associated with the specified node
to
[x, y]. |
void |
setVelocity(org.piccolo2d.PNode node,
Point2D velocity)
Set the velocity for the particle associated with the specified node
to
velocity. |
activityStarted, getActivityScheduler, getDelegate, getDuration, getNextStepTime, getStartTime, getStepRate, getStopTime, isAnimation, isStepping, processStep, setActivityScheduler, setDelegate, setDuration, setStartTime, setStepRate, startAfter, terminate, terminatepublic ParticleSystemActivity(long duration)
duration - duration in milliseconds, or -1 ms for an infinite durationpublic ParticleSystemActivity(long duration,
long stepRate,
long startTime)
duration - duration in milliseconds, or -1 ms for an infinite durationstepRate - step rate in millisecondsstartTime - start time in millisecondspublic void setDrag(float drag)
drag.drag - drag forcepublic void setGravity(float gravity)
gravity.gravity - strength of gravitypublic void createParticle(org.piccolo2d.PNode node,
float mass)
node - node, must not be nullmass - particle masspublic Point2D getVelocity(org.piccolo2d.PNode node)
node - node, must not be nullpublic Point2D getVelocity(org.piccolo2d.PNode node, Point2D velocity)
node - node, must not be nullvelocity - velocity, must not be nullpublic void setVelocity(org.piccolo2d.PNode node,
float x,
float y)
[x, y]. A particle must have already been created
for the specified node.node - node, must not be nullx - velocity xy - velocity ypublic void setVelocity(org.piccolo2d.PNode node,
Point2D velocity)
velocity. A particle must have already been created
for the specified node.node - node, must not be nullvelocity - velocity, must not be nullpublic float getParticleMass(org.piccolo2d.PNode node)
node - node, must not be nullpublic void setParticleMass(org.piccolo2d.PNode node,
float mass)
mass.
A particle must have already been created for the specified node.node - node, must not be nullmass - particle masspublic void clamp(org.piccolo2d.PNode node)
[0.0f, 0.0f]. A particle must have already been created
for the specified node. A clamped particle will receive updated position
data from the full bounds of the specified node.node - node, must not be nullpublic void release(org.piccolo2d.PNode node)
node - node, must not be nullpublic void createSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength,
float damping,
float restLength)
source - source node, must not be nulltarget - target node, must not be nullstrength - spring strengthdamping - damping factorrestLength - rest lengthpublic void enableSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void disableSpring(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic float getSpringRestLength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void setSpringRestLength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float restLength)
restLength.
A spring must have already been created for the specified source and target nodes.source - source node, must not be nulltarget - target node, must not be nullrestLength - rest lengthpublic float getSpringStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void setSpringStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength)
strength.
A spring must have already been created for the specified source and target nodes.source - source node, must not be nulltarget - target node, must not be nullstrength - spring strengthpublic float getSpringDamping(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void setSpringDamping(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float damping)
dampingFactor. A spring must have already been created for the specified
source and target nodes.source - source node, must not be nulltarget - target node, must not be nulldamping - damping factorpublic void createAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength,
float minimumDistance)
source - source node, must not be nulltarget - target node, must not be nullstrength - attraction (or repulsion) force strengthminimumDistance - minimum distancepublic void enableAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void disableAttraction(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic float getAttractionStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void setAttractionStrength(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float strength)
strength.
An attraction must have already been created for the specified source and target nodes.source - source node, must not be nulltarget - target node, must not be nullstrength - attraction (or repulsion) force strengthpublic float getAttractionMinimumDistance(org.piccolo2d.PNode source,
org.piccolo2d.PNode target)
source - source node, must not be nulltarget - target node, must not be nullpublic void setAttractionMinimumDistance(org.piccolo2d.PNode source,
org.piccolo2d.PNode target,
float minimumDistance)
minimumDistance. An attraction must have already been created for the
specified source and target nodes.source - source node, must not be nulltarget - target node, must not be nullminimumDistance - minimum distanceprotected void activityStep(long elapsedTime)
If subclasses override this method, they must call super.activityFinished().
activityStep in class org.piccolo2d.activities.PActivityprotected void activityFinished()
If subclasses override this method, they must call super.activityFinished().
activityFinished in class org.piccolo2d.activities.PActivityCopyright (c) 2009-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).