MotionController

public class MotionController


This contains the picture of a view through the 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 @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int

Public methods

@NonNull void
@NonNull int

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

@NonNull void
getCenter(
    @NonNull double p,
    @NonNull Array<@NonNull float> pos,
    @NonNull Array<@NonNull float> vel
)
@NonNull float
@NonNull float
@NonNull int
@NonNull float

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

@NonNull float

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

@NonNull float

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

@NonNull float

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

@NonNull int
getKeyFrameInfo(@NonNull int type, @NonNull Array<@NonNull 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 ...

@NonNull int
getKeyFramePositions(
    @NonNull Array<@NonNull int> type,
    @NonNull Array<@NonNull float> pos
)

Get the keyFrames for the view controlled by this MotionController

@NonNull float

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

@NonNull float

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

@NonNull float

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

@NonNull float

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

@NonNull int

Get the view to pivot around

@NonNull View
@NonNull void
setDrawPath(@NonNull int debugMode)
@NonNull void
@NonNull void
setStartState(
    @NonNull ViewState rect,
    @NonNull View v,
    @NonNull int rotation,
    @NonNull int preWidth,
    @NonNull int preHeight
)
@NonNull void
setTransformPivotTarget(@NonNull int transformPivotTarget)

Set a view to pivot around

@NonNull void
@NonNull void
setup(
    @NonNull int parentWidth,
    @NonNull int parentHeight,
    @NonNull float transitionDuration,
    @NonNull long currentTime
)

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

@NonNull void
@NonNull String

Debug string

Constants

DRAW_PATH_AS_CONFIGURED

@NonNull
public static final @NonNull int DRAW_PATH_AS_CONFIGURED

DRAW_PATH_BASIC

@NonNull
public static final @NonNull int DRAW_PATH_BASIC

DRAW_PATH_CARTESIAN

@NonNull
public static final @NonNull int DRAW_PATH_CARTESIAN

DRAW_PATH_NONE

@NonNull
public static final @NonNull int DRAW_PATH_NONE

DRAW_PATH_RECTANGLE

@NonNull
public static final @NonNull int DRAW_PATH_RECTANGLE

DRAW_PATH_RELATIVE

@NonNull
public static final @NonNull int DRAW_PATH_RELATIVE

DRAW_PATH_SCREEN

@NonNull
public static final @NonNull int DRAW_PATH_SCREEN

HORIZONTAL_PATH_X

@NonNull
public static final @NonNull int HORIZONTAL_PATH_X

HORIZONTAL_PATH_Y

@NonNull
public static final @NonNull int HORIZONTAL_PATH_Y

PATH_PERCENT

@NonNull
public static final @NonNull int PATH_PERCENT

PATH_PERPENDICULAR

@NonNull
public static final @NonNull int PATH_PERPENDICULAR

ROTATION_LEFT

@NonNull
public static final @NonNull int ROTATION_LEFT

ROTATION_RIGHT

@NonNull
public static final @NonNull int ROTATION_RIGHT

VERTICAL_PATH_X

@NonNull
public static final @NonNull int VERTICAL_PATH_X

VERTICAL_PATH_Y

@NonNull
public static final @NonNull int VERTICAL_PATH_Y

Public methods

addKey

@NonNull
public void addKey(@NonNull Key key)

getAnimateRelativeTo

@NonNull
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

@NonNull
public void getCenter(
    @NonNull double p,
    @NonNull Array<@NonNull float> pos,
    @NonNull Array<@NonNull float> vel
)

getCenterX

@NonNull
public float getCenterX()

getCenterY

@NonNull
public float getCenterY()

getDrawPath

@NonNull
public int getDrawPath()

getFinalHeight

@NonNull
public float getFinalHeight()

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

Returns
float

the height at the end

getFinalWidth

@NonNull
public float getFinalWidth()

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

Returns
float

the width at the end

getFinalX

@NonNull
public float getFinalX()

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

Returns
float

the left most position

getFinalY

@NonNull
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

@NonNull
public int getKeyFrameInfo(@NonNull int type, @NonNull Array<@NonNull 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 ... length

Parameters
@NonNull Array<@NonNull int> info

is a data structure array of int that holds info on each keyframe

Returns
int

Number of keyFrames found

getKeyFramePositions

@NonNull
public int getKeyFramePositions(
    @NonNull Array<@NonNull int> type,
    @NonNull Array<@NonNull float> pos
)

Get the keyFrames for the view controlled by this MotionController

Parameters
@NonNull Array<@NonNull int> type

is position(0-100) + 1000*mType(1=Attributes, 2=Position, 3=TimeCycle 4=Cycle 5=Trigger

@NonNull Array<@NonNull float> pos

the x&y position of the keyFrame along the path

Returns
int

Number of keyFrames found

getStartHeight

@NonNull
public float getStartHeight()

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

Returns
float

the height at the start

getStartWidth

@NonNull
public float getStartWidth()

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

Returns
float

the width at the start

getStartX

@NonNull
public float getStartX()

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

Returns
float

the left most position

getStartY

@NonNull
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

@NonNull
public int getTransformPivotTarget()

Get the view to pivot around

Returns
int

id of view or UNSET if not set

getView

@NonNull
public View getView()

setDrawPath

@NonNull
public void setDrawPath(@NonNull int debugMode)

setPathMotionArc

@NonNull
public void setPathMotionArc(@NonNull int arc)

setStartState

@NonNull
public void setStartState(
    @NonNull ViewState rect,
    @NonNull View v,
    @NonNull int rotation,
    @NonNull int preWidth,
    @NonNull int preHeight
)

setTransformPivotTarget

@NonNull
public void setTransformPivotTarget(@NonNull int transformPivotTarget)

Set a view to pivot around

Parameters
@NonNull int transformPivotTarget

id of view

setView

@NonNull
public void setView(@NonNull View view)

setup

@NonNull
public void setup(
    @NonNull int parentWidth,
    @NonNull int parentHeight,
    @NonNull float transitionDuration,
    @NonNull long currentTime
)

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

setupRelative

@NonNull
public void setupRelative(@NonNull MotionController motionController)

toString

@NonNull
public String toString()

Debug string

Returns
String