|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvitro.Tweener
public class Tweener
A utility class for producing 2D eased animation "tweens" or interpolation. This default implementation provides a sigmoid (ease-in, ease-out) response curve.
Constructor Summary | |
---|---|
Tweener(int x1,
double length,
Tweener next)
Produce a chained 1D tween. |
|
Tweener(int x1,
int x2,
double length)
Produce a 1D tween. |
|
Tweener(int x1,
int y1,
double length,
Tweener next)
Produce a chained 2D tween. |
|
Tweener(int x1,
int y1,
int x2,
int y2,
double length)
Produce a 1D tween. |
|
Tweener(Point start,
double length,
Tweener next)
Produce a chained 2D tween. |
|
Tweener(Point start,
Point end,
double length)
Produce a 2D tween. |
Method Summary | |
---|---|
boolean |
done()
Check the status of this tween of chain of tweens. |
Point |
position()
A Point representing the current tweened position. |
void |
reset()
Reset this Tweener and any later chained Tweener to the initial start point of the animation. |
void |
tick(double time)
Advance the timer for this tween or chain of tweens. |
protected double |
tween(double a,
double b,
double t)
The actual interpolation function. |
int |
x()
Obtain the tweened x-coordinate in a 2D tween or the only tweened x-coordinate in a 1D tween, in pixels. |
double |
xd()
A more accurate representation than x() for small tweens. |
int |
y()
Obtain the tweened y-coordinate, in pixels. |
double |
yd()
A more accurate representation than y() for small tweens. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Tweener(int x1, double length, Tweener next)
x1
- the starting x-coordinate of the tween.length
- how long this tween will take (arbitrary units).next
- the Tweener to transition to after this Tweener completes.public Tweener(Point start, double length, Tweener next)
start
- the starting position of the tween.length
- how long this tween will take (arbitrary units).next
- the Tweener to transition to after this Tweener completes.public Tweener(int x1, int y1, double length, Tweener next)
x1
- the starting x-coordinate of the tween.y1
- the starting y-coordinate of the tween.length
- how long this tween will take (arbitrary units).next
- the Tweener to transition to after this Tweener completes.public Tweener(int x1, int x2, double length)
x1
- the starting x-coordinate of the tween.x2
- the final x-coordinate of the tween.length
- how long this tween will take (arbitrary units).public Tweener(Point start, Point end, double length)
start
- the starting position of the tween.end
- the final position of the tween.length
- how long this tween will take (arbitrary units).public Tweener(int x1, int y1, int x2, int y2, double length)
x1
- the starting x-coordinate of the tween.y1
- the starting y-coordinate of the tween.x2
- the final x-coordinate of the tween.y2
- the final y-coordinate of the tween.length
- how long this tween will take (arbitrary units).Method Detail |
---|
public void tick(double time)
time
- the change in time since the previous frame.public boolean done()
public int x()
public int y()
public double xd()
public double yd()
public Point position()
public void reset()
protected double tween(double a, double b, double t)
a
- the start point of a 1D tween.b
- the end point of a 1D tween.t
- the tween value, on a range from 0 to 1.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |