MotionController
public class MotionController
Contains the picture of a view through a transition and is used to interpolate it. During an transition every view has a MotionController which drives its position.
All parameter which affect a views motion are added to MotionController and then setup() builds out the splines that control the view.
Summary
Constants |
|
|---|---|
static final int |
|
static final int |
DRAW_PATH_BASIC = 1 |
static final int |
|
static final int |
DRAW_PATH_NONE = 0 |
static final int |
|
static final int |
|
static final int |
DRAW_PATH_SCREEN = 6 |
static final int |
|
static final int |
|
static final int |
PATH_PERCENT = 0 |
static final int |
|
static final int |
ROTATION_LEFT = 2 |
static final int |
ROTATION_RIGHT = 1 |
static final int |
VERTICAL_PATH_X = 4 |
static final int |
VERTICAL_PATH_Y = 5 |
Public methods |
|
|---|---|
void |
Add a key to the MotionController |
int |
Will return the id of the view to move relative to. |
void |
getCenter(double p, float[] pos, float[] vel)Get a center and velocities at the position p |
float |
Get the center X of the motion at the current progress |
float |
Get the center Y of the motion at the current progress |
int |
returns the draw path mode |
float |
get the width of the widget at the end of the movement. |
float |
get the width of the widget at the end of the movement. |
float |
get the left most position of the widget at the end of the movement. |
float |
get the top most position of the widget at the end of the movement. |
int |
getKeyFrameInfo(int type, int[] info)Get the keyFrames for the view controlled by this MotionController. the info data structure is of 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 ... length |
int |
getKeyFramePositions(int[] type, float[] pos)Get the keyFrames for the view controlled by this MotionController |
float |
get the width of the widget at the start of the movement. |
float |
get the width of the widget at the start of the movement. |
float |
get the left most position of the widget at the start of the movement. |
float |
get the top most position of the widget at the start of the movement. |
int |
Get the view to pivot around |
View |
getView()Get the view that is being controlled |
void |
During the next layout call measure then layout |
void |
setDrawPath(int debugMode) |
void |
setPathMotionArc(int arc) |
void |
setStartState(configure the position of the view |
void |
setTransformPivotTarget(int transformPivotTarget)Set a view to pivot around |
void |
|
void |
setup(Called after all TimePoints &Cycles have been added; Spines are evaluated |
void |
setupRelative(MotionController motionController)This ties one motionController to another to allow relative pathes |
String |
toString()Debug string |
Constants
Public methods
addKey
public void addKey(Key key)
Add a key to the MotionController
| Parameters | |
|---|---|
Key key |
getAnimateRelativeTo
public 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
| Returns | |
|---|---|
int |
the view id of the view this is in polar mode to or -1 if not in polar |
getCenter
public void getCenter(double p, float[] pos, float[] vel)
Get a center and velocities at the position p
| Parameters | |
|---|---|
double p |
|
float[] pos |
|
float[] vel |
getCenterX
public float getCenterX()
Get the center X of the motion at the current progress
| Returns | |
|---|---|
float |
getCenterY
public float getCenterY()
Get the center Y of the motion at the current progress
| Returns | |
|---|---|
float |
getFinalHeight
public float getFinalHeight()
get the width of the widget at the end of the movement.
| Returns | |
|---|---|
float |
the height at the end |
getFinalWidth
public float getFinalWidth()
get the width of the widget at the end of the movement.
| Returns | |
|---|---|
float |
the width at the end |
getFinalX
public float getFinalX()
get the left most position of the widget at the end of the movement.
| Returns | |
|---|---|
float |
the left most position |
getFinalY
public float getFinalY()
get the top most position of the widget at the end of the movement. Positive is down.
| Returns | |
|---|---|
float |
the top most position |
getKeyFrameInfo
public int getKeyFrameInfo(int type, int[] info)
Get the keyFrames for the view controlled by this MotionController. the info data structure is of 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 ... length
| Parameters | |
|---|---|
int[] info |
is a data structure array of int that holds info on each keyframe |
| Returns | |
|---|---|
int |
Number of keyFrames found |
getKeyFramePositions
public int getKeyFramePositions(int[] type, float[] pos)
Get the keyFrames for the view controlled by this MotionController
| Parameters | |
|---|---|
int[] type |
is position(0-100) + 1000*mType(1=Attr, 2=Pos, 3=TimeCycle 4=Cycle 5=Trigger |
float[] pos |
the x&y position of the keyFrame along the path |
| Returns | |
|---|---|
int |
Number of keyFrames found |
getStartHeight
public float getStartHeight()
get the width of the widget at the start of the movement.
| Returns | |
|---|---|
float |
the height at the start |
getStartWidth
public float getStartWidth()
get the width of the widget at the start of the movement.
| Returns | |
|---|---|
float |
the width at the start |
getStartX
public float getStartX()
get the left most position of the widget at the start of the movement.
| Returns | |
|---|---|
float |
the left most position |
getStartY
public float getStartY()
get the top most position of the widget at the start of the movement. Positive is down.
| Returns | |
|---|---|
float |
the top most position |
getTransformPivotTarget
public int getTransformPivotTarget()
Get the view to pivot around
| Returns | |
|---|---|
int |
id of view or UNSET if not set |
setStartState
public void setStartState(
ViewState rect,
View v,
int rotation,
int preWidth,
int preHeight
)
configure the position of the view
setTransformPivotTarget
public void setTransformPivotTarget(int transformPivotTarget)
Set a view to pivot around
| Parameters | |
|---|---|
int transformPivotTarget |
id of view |
setup
public void setup(
int parentWidth,
int parentHeight,
float transitionDuration,
long currentTime
)
Called after all TimePoints &Cycles have been added; Spines are evaluated
setupRelative
public void setupRelative(MotionController motionController)
This ties one motionController to another to allow relative pathes
| Parameters | |
|---|---|
MotionController motionController |