|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpulpcore.math.Path
public class Path
The Path class is a series of straight lines and curves that a Sprite can animate along.
Paths points are immutable, but the path can be translated to another location.
Paths are created from a subset of the SVG path commands. Only M (absolute move-to), L (absolute line-to) and C (absolute curve to) commands are supported. For example, a triangle path:
path = new Path("M 100 100 L 300 100 L 200 300 L 100 100");
A simple curve:
path = new Path("M100,200 C100,100 400,100 400,200");
Spaces are not required. Floating point values are accepted.
See http://www.w3.org/TR/SVG/paths.html#PathData
Note, the Path class is not used for rendering paths or shapes. Also, the Path class may change substantially in future iterations of PulpCore.
| Field Summary | |
|---|---|
static int |
X_AXIS
|
static int |
Y_AXIS
|
| Constructor Summary | |
|---|---|
Path(int[] xPoints,
int[] yPoints)
|
|
Path(String svgPathData)
Parse an SVG path data string. |
|
| Method Summary | |
|---|---|
void |
draw(CoreGraphics g,
boolean drawJoints)
Draws the segments of this path using the current color. |
double |
getAngle(double p)
|
int |
getEndX()
|
int |
getEndY()
|
double |
getLength()
|
int |
getStartX()
|
int |
getStartY()
|
double |
getX(double p)
|
double |
getY(double p)
|
void |
guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration)
|
void |
guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration,
Easing easing)
|
void |
guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration,
Easing easing,
int startDelay)
|
void |
guide(Timeline timeline,
Sprite sprite,
int duration)
|
void |
guide(Timeline timeline,
Sprite sprite,
int duration,
Easing easing)
|
void |
guide(Timeline timeline,
Sprite sprite,
int duration,
Easing easing,
int startDelay)
|
void |
guideBackwards(Timeline timeline,
Sprite sprite,
int duration)
|
void |
guideBackwards(Timeline timeline,
Sprite sprite,
int duration,
Easing easing)
|
void |
guideBackwards(Timeline timeline,
Sprite sprite,
int duration,
Easing easing,
int startDelay)
|
void |
place(Sprite sprite,
double p)
Places a Sprite at a position along the path. |
void |
translate(double x,
double y)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int X_AXIS
public static final int Y_AXIS
| Constructor Detail |
|---|
public Path(String svgPathData)
throws IllegalArgumentException
IllegalArgumentException - If the path data string could not be parsed.
public Path(int[] xPoints,
int[] yPoints)
| Method Detail |
|---|
public double getLength()
public void translate(double x,
double y)
public int getStartX()
public int getStartY()
public int getEndX()
public int getEndY()
public double getX(double p)
public double getY(double p)
public double getAngle(double p)
public void place(Sprite sprite,
double p)
sprite - The Sprite to place.p - The position along the path to place the sprite, from 0 to 1.
public void guide(Timeline timeline,
Sprite sprite,
int duration)
public void guide(Timeline timeline,
Sprite sprite,
int duration,
Easing easing)
public void guide(Timeline timeline,
Sprite sprite,
int duration,
Easing easing,
int startDelay)
public void guideBackwards(Timeline timeline,
Sprite sprite,
int duration)
public void guideBackwards(Timeline timeline,
Sprite sprite,
int duration,
Easing easing)
public void guideBackwards(Timeline timeline,
Sprite sprite,
int duration,
Easing easing,
int startDelay)
public void guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration)
public void guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration,
Easing easing)
public void guide(Timeline timeline,
Sprite sprite,
double startP,
double endP,
int duration,
Easing easing,
int startDelay)
public void draw(CoreGraphics g,
boolean drawJoints)
drawJoints - if true, draw rectangles at the joints between line segments
|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||