public abstract class Dynamic
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACCESS_TYPE_RANDOM
The default mode of access.
|
static int |
ACCESS_TYPE_SEQUENTIAL
Set the mode to ACCESS_SEQUENTIAL if you need to change mDuration and you would rather have the Dynamic
keep on smoothly interpolating.
|
static int |
MODE_JUMP
One revolution takes us from the first point to the last and jumps straight back to the first point.
|
static int |
MODE_LOOP
One revolution takes us from the first point to the last and back to first through the shortest path.
|
static int |
MODE_PATH
One revolution takes us from the first point to the last and back to first through the same path.
|
Modifier and Type | Method and Description |
---|---|
boolean |
get(float[] buffer,
int offset,
long time,
long step)
Writes the results of interpolation between the Points at time 'time' to the passed float buffer.
|
float |
getConvexity() |
float |
getCount()
Return the number of revolutions this Dynamic will make.
|
int |
getDimension()
Return the Dimension, ie number of floats in a single Point this Dynamic interpolates through.
|
long |
getDuration() |
int |
getNumPoints()
Returns the number of Points this Dynamic has been fed with.
|
static void |
onPause() |
void |
resetToBeginning()
Start running from the beginning again.
|
void |
setAccessType(int type)
Sets the access type this Dynamic will be working in.
|
void |
setConvexity(float convexity) |
void |
setCount(float count)
Sets how many revolutions we want to do.
|
void |
setDuration(long duration) |
void |
setMode(int mode)
Sets the mode of the interpolation to Loop, Path or Jump.
|
public static final int MODE_LOOP
public static final int MODE_PATH
public static final int MODE_JUMP
public static final int ACCESS_TYPE_RANDOM
public static final int ACCESS_TYPE_SEQUENTIAL
public static void onPause()
public void setMode(int mode)
public int getNumPoints()
public void setCount(float count)
Does not have to be an integer. What constitutes 'one revolution' depends on the MODE:
MODE_LOOP
, MODE_PATH
or MODE_JUMP
.
Count<=0 means 'go on interpolating indefinitely'.
count
- the number of times we want to interpolate between our collection of Points.public float getCount()
MODE_LOOP
, MODE_PATH
or MODE_JUMP
.public void resetToBeginning()
public void setDuration(long duration)
public long getDuration()
public void setConvexity(float convexity)
convexity
- If set to the default (1.0f) then interpolation between 4 points
(1,0) (0,1) (-1,0) (0,-1) will be the natural circle centered at (0,0) with radius 1.
The less it is, the less convex the circle becomes, ultimately when convexity=0.0f
then the interpolation shape will be straight lines connecting the four points.
Further setting this to negative values will make the shape concave.
Valid values: all floats. (although probably only something around (0,2) actually
makes sense)public float getConvexity()
setConvexity(float)
public void setAccessType(int type)
type
- ACCESS_TYPE_RANDOM
or ACCESS_TYPE_SEQUENTIAL
.public int getDimension()
public boolean get(float[] buffer, int offset, long time, long step)
This version differs from the previous in that it returns a boolean value which indicates whether the interpolation is finished.
buffer
- Float buffer we will write the results to.offset
- Offset in the buffer where to write the result.time
- Time of interpolation. Time=0.0 is the beginning of the first revolution, time=1.0 - the end
of the first revolution, time=2.5 - the middle of the third revolution.
What constitutes 'one revolution' depends on the MODE:
MODE_LOOP
, MODE_PATH
or MODE_JUMP
.step
- Time difference between now and the last time we called this function. Needed to figure
out if the previous time we were called the effect wasn't finished yet, but now it is.