MotionController


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

Public functions

Unit
addKey(key: Key!)

Add a key to the MotionController

Int

Will return the id of the view to move relative to.

Unit
getCenter(p: Double, pos: FloatArray!, vel: FloatArray!)

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(type: Int, info: IntArray!)

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

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

Unit

During the next layout call measure then layout

Unit
setDrawPath(debugMode: Int)
Unit
Unit
setStartState(
    rect: ViewState!,
    v: View!,
    rotation: Int,
    preWidth: Int,
    preHeight: Int
)

configure the position of the view

Unit
setTransformPivotTarget(transformPivotTarget: Int)

Set a view to pivot around

Unit
setView(view: View!)
Unit
setup(
    parentWidth: Int,
    parentHeight: Int,
    transitionDuration: Float,
    currentTime: Long
)

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

Unit
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
const val DRAW_PATH_AS_CONFIGURED = 4: Int

DRAW_PATH_BASIC

Added in 2.2.0
const val DRAW_PATH_BASIC = 1: Int

DRAW_PATH_CARTESIAN

Added in 2.2.0
const val DRAW_PATH_CARTESIAN = 3: Int

DRAW_PATH_NONE

Added in 2.2.0
const val DRAW_PATH_NONE = 0: Int

DRAW_PATH_RECTANGLE

Added in 2.2.0
const val DRAW_PATH_RECTANGLE = 5: Int

DRAW_PATH_RELATIVE

Added in 2.2.0
const val DRAW_PATH_RELATIVE = 2: Int

DRAW_PATH_SCREEN

Added in 2.2.0
const val DRAW_PATH_SCREEN = 6: Int

HORIZONTAL_PATH_X

Added in 2.2.0
const val HORIZONTAL_PATH_X = 2: Int

HORIZONTAL_PATH_Y

Added in 2.2.0
const val HORIZONTAL_PATH_Y = 3: Int

PATH_PERCENT

Added in 2.2.0
const val PATH_PERCENT = 0: Int

PATH_PERPENDICULAR

Added in 2.2.0
const val PATH_PERPENDICULAR = 1: Int

ROTATION_LEFT

Added in 2.2.0
const val ROTATION_LEFT = 2: Int

ROTATION_RIGHT

Added in 2.2.0
const val ROTATION_RIGHT = 1: Int

VERTICAL_PATH_X

Added in 2.2.0
const val VERTICAL_PATH_X = 4: Int

VERTICAL_PATH_Y

Added in 2.2.0
const val VERTICAL_PATH_Y = 5: Int

Public functions

addKey

Added in 2.2.0
fun addKey(key: Key!): Unit

Add a key to the MotionController

Parameters
key: Key!

getAnimateRelativeTo

Added in 2.2.0
fun getAnimateRelativeTo(): 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

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
fun getCenter(p: Double, pos: FloatArray!, vel: FloatArray!): Unit

Get a center and velocities at the position p

Parameters
p: Double
pos: FloatArray!
vel: FloatArray!

getCenterX

Added in 2.2.0
fun getCenterX(): Float

Get the center X of the motion at the current progress

Returns
Float

getCenterY

Added in 2.2.0
fun getCenterY(): Float

Get the center Y of the motion at the current progress

Returns
Float

getDrawPath

Added in 2.2.0
fun getDrawPath(): Int

returns the draw path mode

Returns
Int

getFinalHeight

Added in 2.2.0
fun getFinalHeight(): Float

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
fun getFinalWidth(): Float

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
fun getFinalX(): Float

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
fun getFinalY(): Float

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
fun getKeyFrameInfo(type: Int, info: IntArray!): Int

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
info: IntArray!

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
fun getKeyFramePositions(type: IntArray!, pos: FloatArray!): Int

Get the keyFrames for the view controlled by this MotionController

Parameters
type: IntArray!

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

pos: FloatArray!

the x&y position of the keyFrame along the path

Returns
Int

Number of keyFrames found

getStartHeight

Added in 2.2.0
fun getStartHeight(): Float

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
fun getStartWidth(): Float

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
fun getStartX(): Float

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
fun getStartY(): Float

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
fun getTransformPivotTarget(): Int

Get the view to pivot around

Returns
Int

id of view or UNSET if not set

getView

Added in 2.2.0
fun getView(): View!

Get the view that is being controlled

Returns
View!

remeasure

Added in 2.2.0
fun remeasure(): Unit

During the next layout call measure then layout

setDrawPath

Added in 2.2.0
fun setDrawPath(debugMode: Int): Unit

setPathMotionArc

Added in 2.2.0
fun setPathMotionArc(arc: Int): Unit

setStartState

Added in 2.2.0
fun setStartState(
    rect: ViewState!,
    v: View!,
    rotation: Int,
    preWidth: Int,
    preHeight: Int
): Unit

configure the position of the view

Parameters
rect: ViewState!
v: View!
rotation: Int
preWidth: Int
preHeight: Int

setTransformPivotTarget

Added in 2.2.0
fun setTransformPivotTarget(transformPivotTarget: Int): Unit

Set a view to pivot around

Parameters
transformPivotTarget: Int

id of view

setView

Added in 2.2.0
fun setView(view: View!): Unit
Parameters
view: View!

setup

Added in 2.2.0
fun setup(
    parentWidth: Int,
    parentHeight: Int,
    transitionDuration: Float,
    currentTime: Long
): Unit

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

setupRelative

Added in 2.2.0
fun setupRelative(motionController: MotionController!): Unit

This ties one motionController to another to allow relative pathes

Parameters
motionController: MotionController!

toString

fun toString(): String!

Debug string

Returns
String!