public class Motion extends java.lang.Object implements TypedValues
All parameter which affect a views motion are added to MotionController and then setup() builds out the splines that control the view.
TypedValues.AttributesType, TypedValues.Custom, TypedValues.CycleType, TypedValues.MotionScene, TypedValues.MotionType, TypedValues.OnSwipe, TypedValues.PositionType, TypedValues.TransitionType, TypedValues.TriggerType| Modifier and Type | Field and Description |
|---|---|
static int |
DRAW_PATH_AS_CONFIGURED |
static int |
DRAW_PATH_BASIC |
static int |
DRAW_PATH_CARTESIAN |
static int |
DRAW_PATH_NONE |
static int |
DRAW_PATH_RECTANGLE |
static int |
DRAW_PATH_RELATIVE |
static int |
DRAW_PATH_SCREEN |
static int |
HORIZONTAL_PATH_X |
static int |
HORIZONTAL_PATH_Y |
static int |
PATH_PERCENT |
static int |
PATH_PERPENDICULAR |
static int |
ROTATION_LEFT |
static int |
ROTATION_RIGHT |
static int |
VERTICAL_PATH_X |
static int |
VERTICAL_PATH_Y |
BOOLEAN_MASK, FLOAT_MASK, INT_MASK, S_CUSTOM, STRING_MASK, TYPE_FRAME_POSITION, TYPE_TARGET| Constructor and Description |
|---|
Motion(MotionWidget view) |
| Modifier and Type | Method and Description |
|---|---|
void |
addKey(MotionKey key) |
int |
buildKeyFrames(float[] keyFrames,
int[] mode,
int[] pos) |
void |
buildPath(float[] points,
int pointCount)
fill the array point with the center coordinates point[0] is filled with the
x coordinate of "time" 0.0 mPoints[point.length-1] is filled with the y coordinate of "time"
1.0
|
void |
buildRect(float p,
float[] path,
int offset) |
int |
getAnimateRelativeTo()
Will return the id of the view to move relative to
The position at the start and then end will be viewed relative to this view
-1 is the return value if NOT in polar mode
|
void |
getCenter(double p,
float[] pos,
float[] vel) |
float |
getCenterX() |
float |
getCenterY() |
int |
getDrawPath() |
float |
getFinalHeight()
get the width of the widget at the end of the movement.
|
float |
getFinalWidth()
get the width of the widget at the end of the movement.
|
float |
getFinalX()
get the left most position of the widget at the end of the movement.
|
float |
getFinalY()
get the top most position of the widget at the end of the movement.
|
int |
getId(java.lang.String name) |
MotionPaths |
getKeyFrame(int i)
provides acces to MotionPath objects
|
int |
getKeyFrameInfo(int type,
int[] info)
Get the keyFrames for the view controlled by this MotionController
the info data structure is of the the form
0 length if your are at index i the [i+len+1] is the next entry
1 type 1=Attributes, 2=Position, 3=TimeCycle 4=Cycle 5=Trigger
2 position
3 x location
4 y location
5
...
|
int |
getKeyFramePositions(int[] type,
float[] pos)
Get the keyFrames for the view controlled by this MotionController
|
float |
getStartHeight()
get the width of the widget at the start of the movement.
|
float |
getStartWidth()
get the width of the widget at the start of the movement.
|
float |
getStartX()
get the left most position of the widget at the start of the movement.
|
float |
getStartY()
get the top most position of the widget at the start of the movement.
|
int |
getTransformPivotTarget()
Get the view to pivot around
|
MotionWidget |
getView() |
boolean |
interpolate(MotionWidget child,
float global_position,
long time,
KeyCache keyCache)
The main driver of interpolation
|
void |
setDrawPath(int debugMode) |
void |
setEnd(MotionWidget mw) |
void |
setPathMotionArc(int arc) |
void |
setStart(MotionWidget mw) |
void |
setStartState(ViewState rect,
MotionWidget v,
int rotation,
int preWidth,
int preHeight) |
void |
setTransformPivotTarget(int transformPivotTarget)
Set a view to pivot around
|
void |
setup(int parentWidth,
int parentHeight,
float transitionDuration,
long currentTime)
Called after all TimePoints & Cycles have been added;
Spines are evaluated
|
void |
setupRelative(Motion motionController) |
boolean |
setValue(int id,
boolean value)
Used to set boolean values
|
boolean |
setValue(int id,
float value)
Used to set float values
|
boolean |
setValue(int id,
int value)
Used to set integer values
|
boolean |
setValue(int id,
java.lang.String value)
Used to set String values
|
void |
setView(MotionWidget view) |
java.lang.String |
toString()
Debug string
|
public static final int PATH_PERCENT
public static final int PATH_PERPENDICULAR
public static final int HORIZONTAL_PATH_X
public static final int HORIZONTAL_PATH_Y
public static final int VERTICAL_PATH_X
public static final int VERTICAL_PATH_Y
public static final int DRAW_PATH_NONE
public static final int DRAW_PATH_BASIC
public static final int DRAW_PATH_RELATIVE
public static final int DRAW_PATH_CARTESIAN
public static final int DRAW_PATH_AS_CONFIGURED
public static final int DRAW_PATH_RECTANGLE
public static final int DRAW_PATH_SCREEN
public static final int ROTATION_RIGHT
public static final int ROTATION_LEFT
public Motion(MotionWidget view)
public int getTransformPivotTarget()
public void setTransformPivotTarget(int transformPivotTarget)
transformPivotTarget - id of viewpublic MotionPaths getKeyFrame(int i)
i - public float getStartX()
public float getStartY()
public float getFinalX()
public float getFinalY()
public float getStartWidth()
public float getStartHeight()
public float getFinalWidth()
public float getFinalHeight()
public int getAnimateRelativeTo()
public void setupRelative(Motion motionController)
public float getCenterX()
public float getCenterY()
public void getCenter(double p,
float[] pos,
float[] vel)
public void buildPath(float[] points,
int pointCount)
points - array to fill (should be 2x the number of mPointspointCount - public int buildKeyFrames(float[] keyFrames,
int[] mode,
int[] pos)
public void buildRect(float p,
float[] path,
int offset)
public void addKey(MotionKey key)
public void setPathMotionArc(int arc)
public void setup(int parentWidth,
int parentHeight,
float transitionDuration,
long currentTime)
public java.lang.String toString()
toString in class java.lang.Objectpublic void setView(MotionWidget view)
public MotionWidget getView()
public void setStart(MotionWidget mw)
public void setEnd(MotionWidget mw)
public void setStartState(ViewState rect, MotionWidget v, int rotation, int preWidth, int preHeight)
public boolean interpolate(MotionWidget child, float global_position, long time, KeyCache keyCache)
child - global_position - time - keyCache - public int getDrawPath()
public void setDrawPath(int debugMode)
public int getKeyFramePositions(int[] type,
float[] pos)
type - is position(0-100) + 1000*mType(1=Attributes, 2=Position, 3=TimeCycle 4=Cycle 5=Triggerpos - the x&y position of the keyFrame along the pathpublic int getKeyFrameInfo(int type,
int[] info)
info - is a data structure array of int that holds info on each keyframepublic boolean setValue(int id,
int value)
TypedValuessetValue in interface TypedValuespublic boolean setValue(int id,
float value)
TypedValuessetValue in interface TypedValuespublic boolean setValue(int id,
java.lang.String value)
TypedValuessetValue in interface TypedValuespublic boolean setValue(int id,
boolean value)
TypedValuessetValue in interface TypedValuespublic int getId(java.lang.String name)
getId in interface TypedValues