class Motion : TypedValues


Contains the picture of a view through a transition and is used to interpolate it. During a 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 constructors

Public functions

Unit
Int
buildKeyFrames(keyFrames: FloatArray!, mode: IntArray!, pos: IntArray!)
Unit
buildPath(points: FloatArray!, pointCount: Int)

Fills 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

Unit
buildRect(p: Float, path: FloatArray!, offset: Int)
String!

Returns the id of the view to move relative to.

Unit
getCenter(p: Double, pos: FloatArray!, vel: FloatArray!)
Float
Float
Unit
getDpDt(
    position: Float,
    locationX: Float,
    locationY: Float,
    mAnchorDpDt: FloatArray!
)

This returns the differential with respect to the animation layout position (Progress) of a point on the view (post layout effects are not computed)

Int
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
getId(name: String!)
MotionPaths!

provides access to MotionPath objects

Int
getKeyFrameInfo(type: Int, info: IntArray!)

Gets the keyFrames for the view controlled by this MotionController.

Int

Get the keyFrames for the view controlled by this MotionController

Float

The values set in motion: { stagger: '2' }

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

MotionWidget!
Boolean
interpolate(
    child: MotionWidget!,
    globalPosition: Float,
    time: Long,
    keyCache: KeyCache!
)

The main driver of interpolation

Unit
setDrawPath(debugMode: Int)
Unit
Unit
setIdString(stringId: String!)
Unit
Unit
setStaggerOffset(staggerOffset: Float)

set the offset used in calculating stagger launches

Unit
setStaggerScale(staggerScale: Float)

Set stagger scale

Unit
Unit
setStartState(
    rect: ViewState!,
    v: MotionWidget!,
    rotation: Int,
    preWidth: Int,
    preHeight: Int
)
Unit
setTransformPivotTarget(transformPivotTarget: Int)

Set a view to pivot around

Boolean
setValue(id: Int, value: Boolean)

Used to set boolean values

Boolean
setValue(id: Int, value: Float)

Used to set float values

Boolean
setValue(id: Int, value: Int)

Used to set integer values

Boolean
setValue(id: Int, value: String!)

Used to set String values

Unit
Unit
setup(
    parentWidth: Int,
    parentHeight: Int,
    transitionDuration: Float,
    currentTime: Long
)

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

Unit
setupRelative(motionController: Motion!)

set up the motion to be relative to this other motionController

String!

Debug string

Public properties

String!

Inherited Constants

From androidx.constraintlayout.core.motion.utils.TypedValues
const Int
const Int
const Int
const Int
const String!
S_CUSTOM = "CUSTOM"
const Int
const Int

Constants

DRAW_PATH_AS_CONFIGURED

Added in 1.1.0-alpha13
const val DRAW_PATH_AS_CONFIGURED = 4: Int

DRAW_PATH_BASIC

Added in 1.1.0-alpha13
const val DRAW_PATH_BASIC = 1: Int

DRAW_PATH_CARTESIAN

Added in 1.1.0-alpha13
const val DRAW_PATH_CARTESIAN = 3: Int

DRAW_PATH_NONE

Added in 1.1.0-alpha13
const val DRAW_PATH_NONE = 0: Int

DRAW_PATH_RECTANGLE

Added in 1.1.0-alpha13
const val DRAW_PATH_RECTANGLE = 5: Int

DRAW_PATH_RELATIVE

Added in 1.1.0-alpha13
const val DRAW_PATH_RELATIVE = 2: Int

DRAW_PATH_SCREEN

Added in 1.1.0-alpha13
const val DRAW_PATH_SCREEN = 6: Int

HORIZONTAL_PATH_X

Added in 1.1.0-alpha13
const val HORIZONTAL_PATH_X = 2: Int

HORIZONTAL_PATH_Y

Added in 1.1.0-alpha13
const val HORIZONTAL_PATH_Y = 3: Int

PATH_PERCENT

Added in 1.1.0-alpha13
const val PATH_PERCENT = 0: Int

PATH_PERPENDICULAR

Added in 1.1.0-alpha13
const val PATH_PERPENDICULAR = 1: Int

ROTATION_LEFT

Added in 1.1.0-alpha13
const val ROTATION_LEFT = 2: Int

ROTATION_RIGHT

Added in 1.1.0-alpha13
const val ROTATION_RIGHT = 1: Int

VERTICAL_PATH_X

Added in 1.1.0-alpha13
const val VERTICAL_PATH_X = 4: Int

VERTICAL_PATH_Y

Added in 1.1.0-alpha13
const val VERTICAL_PATH_Y = 5: Int

Public constructors

Motion

Added in 1.1.0-alpha13
Motion(view: MotionWidget!)

Public functions

addKey

Added in 1.1.0-alpha13
fun addKey(key: MotionKey!): Unit

buildKeyFrames

Added in 1.1.0-alpha13
fun buildKeyFrames(keyFrames: FloatArray!, mode: IntArray!, pos: IntArray!): Int

buildPath

Added in 1.1.0-alpha13
fun buildPath(points: FloatArray!, pointCount: Int): Unit

Fills 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

Parameters
points: FloatArray!

array to fill (should be 2x the number of mPoints

buildRect

Added in 1.1.0-alpha13
fun buildRect(p: Float, path: FloatArray!, offset: Int): Unit

getAnimateRelativeTo

Added in 1.1.0-alpha13
fun getAnimateRelativeTo(): String!

Returns 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
String!

the view id of the view this is in polar mode to or -1 if not in polar

getCenter

Added in 1.1.0-alpha13
fun getCenter(p: Double, pos: FloatArray!, vel: FloatArray!): Unit

getCenterX

Added in 1.1.0-alpha13
fun getCenterX(): Float

getCenterY

Added in 1.1.0-alpha13
fun getCenterY(): Float

getDpDt

Added in 1.1.0-alpha13
fun getDpDt(
    position: Float,
    locationX: Float,
    locationY: Float,
    mAnchorDpDt: FloatArray!
): Unit

This returns the differential with respect to the animation layout position (Progress) of a point on the view (post layout effects are not computed)

Parameters
position: Float

position in time

locationX: Float

the x location on the view (0 = left edge, 1 = right edge)

locationY: Float

the y location on the view (0 = top, 1 = bottom)

mAnchorDpDt: FloatArray!

returns the differential of the motion with respect to the position

getDrawPath

Added in 1.1.0-alpha13
fun getDrawPath(): Int

getFinalHeight

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

getId

Added in 1.1.0-alpha13
fun getId(name: String!): Int

getKeyFrame

Added in 1.1.0-alpha13
fun getKeyFrame(i: Int): MotionPaths!

provides access to MotionPath objects

getKeyFrameInfo

Added in 1.1.0-alpha13
fun getKeyFrameInfo(type: Int, info: IntArray!): Int

Gets 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 1.1.0-alpha13
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=Attributes, 2=Position, 3=TimeCycle 4=Cycle 5=Trigger

pos: FloatArray!

the x&y position of the keyFrame along the path

Returns
Int

Number of keyFrames found

getMotionStagger

Added in 1.1.0-alpha13
fun getMotionStagger(): Float

The values set in motion: { stagger: '2' }

Returns
Float

value from motion: { stagger: ? } or NaN if not set

getStartHeight

Added in 1.1.0-alpha13
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 1.1.0-alpha13
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 1.1.0-alpha13
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 1.1.0-alpha13
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 1.1.0-alpha13
fun getTransformPivotTarget(): Int

Get the view to pivot around

Returns
Int

id of view or UNSET if not set

getView

Added in 1.1.0-alpha13
fun getView(): MotionWidget!

interpolate

Added in 1.1.0-alpha13
fun interpolate(
    child: MotionWidget!,
    globalPosition: Float,
    time: Long,
    keyCache: KeyCache!
): Boolean

The main driver of interpolation

Returns
Boolean

do you need to keep animating

setDrawPath

Added in 1.1.0-alpha13
fun setDrawPath(debugMode: Int): Unit

setEnd

Added in 1.1.0-alpha13
fun setEnd(mw: MotionWidget!): Unit

setIdString

Added in 1.1.0-alpha13
fun setIdString(stringId: String!): Unit

setPathMotionArc

Added in 1.1.0-alpha13
fun setPathMotionArc(arc: Int): Unit

setStaggerOffset

Added in 1.1.0-alpha13
fun setStaggerOffset(staggerOffset: Float): Unit

set the offset used in calculating stagger launches

Parameters
staggerOffset: Float

fraction of progress before this controller runs

setStaggerScale

Added in 1.1.0-alpha13
fun setStaggerScale(staggerScale: Float): Unit

Set stagger scale

setStart

Added in 1.1.0-alpha13
fun setStart(mw: MotionWidget!): Unit

setStartState

Added in 1.1.0-alpha13
fun setStartState(
    rect: ViewState!,
    v: MotionWidget!,
    rotation: Int,
    preWidth: Int,
    preHeight: Int
): Unit

setTransformPivotTarget

Added in 1.1.0-alpha13
fun setTransformPivotTarget(transformPivotTarget: Int): Unit

Set a view to pivot around

Parameters
transformPivotTarget: Int

id of view

setValue

Added in 1.1.0-alpha13
fun setValue(id: Int, value: Boolean): Boolean

Used to set boolean values

Returns
Boolean

true if it accepted the value

setValue

Added in 1.1.0-alpha13
fun setValue(id: Int, value: Float): Boolean

Used to set float values

Returns
Boolean

true if it accepted the value

setValue

Added in 1.1.0-alpha13
fun setValue(id: Int, value: Int): Boolean

Used to set integer values

Returns
Boolean

true if it accepted the value

setValue

Added in 1.1.0-alpha13
fun setValue(id: Int, value: String!): Boolean

Used to set String values

Returns
Boolean

true if it accepted the value

setView

Added in 1.1.0-alpha13
fun setView(view: MotionWidget!): Unit

setup

Added in 1.1.0-alpha13
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 1.1.0-alpha13
fun setupRelative(motionController: Motion!): Unit

set up the motion to be relative to this other motionController

toString

fun toString(): String!

Debug string

Public properties

mId

Added in 1.1.0-alpha13
val mIdString!