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
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Public methods

void
addKey(Key key)

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

Get the view that is being controlled

void

During the next layout call measure then layout

void
setDrawPath(int debugMode)
void
void
setStartState(
    ViewState rect,
    View v,
    int rotation,
    int preWidth,
    int preHeight
)

configure the position of the view

void
setTransformPivotTarget(int transformPivotTarget)

Set a view to pivot around

void
setView(View view)
void
setup(
    int parentWidth,
    int parentHeight,
    float transitionDuration,
    long currentTime
)

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

Debug string

Constants

DRAW_PATH_AS_CONFIGURED

Added in 2.2.0-alpha13
public static final int DRAW_PATH_AS_CONFIGURED = 4

DRAW_PATH_BASIC

Added in 2.2.0-alpha13
public static final int DRAW_PATH_BASIC = 1

DRAW_PATH_CARTESIAN

Added in 2.2.0-alpha13
public static final int DRAW_PATH_CARTESIAN = 3

DRAW_PATH_NONE

Added in 2.2.0-alpha13
public static final int DRAW_PATH_NONE = 0

DRAW_PATH_RECTANGLE

Added in 2.2.0-alpha13
public static final int DRAW_PATH_RECTANGLE = 5

DRAW_PATH_RELATIVE

Added in 2.2.0-alpha13
public static final int DRAW_PATH_RELATIVE = 2

DRAW_PATH_SCREEN

Added in 2.2.0-alpha13
public static final int DRAW_PATH_SCREEN = 6

HORIZONTAL_PATH_X

Added in 2.2.0-alpha13
public static final int HORIZONTAL_PATH_X = 2

HORIZONTAL_PATH_Y

Added in 2.2.0-alpha13
public static final int HORIZONTAL_PATH_Y = 3

PATH_PERCENT

Added in 2.2.0-alpha13
public static final int PATH_PERCENT = 0

PATH_PERPENDICULAR

Added in 2.2.0-alpha13
public static final int PATH_PERPENDICULAR = 1

ROTATION_LEFT

Added in 2.2.0-alpha13
public static final int ROTATION_LEFT = 2

ROTATION_RIGHT

Added in 2.2.0-alpha13
public static final int ROTATION_RIGHT = 1

VERTICAL_PATH_X

Added in 2.2.0-alpha13
public static final int VERTICAL_PATH_X = 4

VERTICAL_PATH_Y

Added in 2.2.0-alpha13
public static final int VERTICAL_PATH_Y = 5

Public methods

addKey

Added in 2.2.0-alpha13
public void addKey(Key key)

Add a key to the MotionController

Parameters
Key key

getAnimateRelativeTo

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
public float getCenterX()

Get the center X of the motion at the current progress

Returns
float

getCenterY

Added in 2.2.0-alpha13
public float getCenterY()

Get the center Y of the motion at the current progress

Returns
float

getDrawPath

Added in 2.2.0-alpha13
public int getDrawPath()

returns the draw path mode

Returns
int

getFinalHeight

Added in 2.2.0-alpha13
public float getFinalHeight()

get the width of the widget at the end of the movement.

Returns
float

the height at the end

getFinalWidth

Added in 2.2.0-alpha13
public float getFinalWidth()

get the width of the widget at the end of the movement.

Returns
float

the width at the end

getFinalX

Added in 2.2.0-alpha13
public float getFinalX()

get the left most position of the widget at the end of the movement.

Returns
float

the left most position

getFinalY

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
public float getStartHeight()

get the width of the widget at the start of the movement.

Returns
float

the height at the start

getStartWidth

Added in 2.2.0-alpha13
public float getStartWidth()

get the width of the widget at the start of the movement.

Returns
float

the width at the start

getStartX

Added in 2.2.0-alpha13
public float getStartX()

get the left most position of the widget at the start of the movement.

Returns
float

the left most position

getStartY

Added in 2.2.0-alpha13
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

Added in 2.2.0-alpha13
public int getTransformPivotTarget()

Get the view to pivot around

Returns
int

id of view or UNSET if not set

getView

Added in 2.2.0-alpha13
public View getView()

Get the view that is being controlled

Returns
View

remeasure

Added in 2.2.0-alpha13
public void remeasure()

During the next layout call measure then layout

setDrawPath

Added in 2.2.0-alpha13
public void setDrawPath(int debugMode)

setPathMotionArc

Added in 2.2.0-alpha13
public void setPathMotionArc(int arc)

setStartState

Added in 2.2.0-alpha13
public void setStartState(
    ViewState rect,
    View v,
    int rotation,
    int preWidth,
    int preHeight
)

configure the position of the view

Parameters
ViewState rect
View v
int rotation
int preWidth
int preHeight

setTransformPivotTarget

Added in 2.2.0-alpha13
public void setTransformPivotTarget(int transformPivotTarget)

Set a view to pivot around

Parameters
int transformPivotTarget

id of view

setView

Added in 2.2.0-alpha13
public void setView(View view)
Parameters
View view

setup

Added in 2.2.0-alpha13
public void setup(
    int parentWidth,
    int parentHeight,
    float transitionDuration,
    long currentTime
)

Called after all TimePoints &Cycles have been added; Spines are evaluated

setupRelative

Added in 2.2.0-alpha13
public void setupRelative(MotionController motionController)

This ties one motionController to another to allow relative pathes

Parameters
MotionController motionController

toString

public String toString()

Debug string

Returns
String