Motion
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
Constants |
|
|---|---|
const Int |
|
const Int |
DRAW_PATH_BASIC = 1 |
const Int |
|
const Int |
DRAW_PATH_NONE = 0 |
const Int |
|
const Int |
|
const Int |
DRAW_PATH_SCREEN = 6 |
const Int |
|
const Int |
|
const Int |
PATH_PERCENT = 0 |
const Int |
|
const Int |
ROTATION_LEFT = 2 |
const Int |
ROTATION_RIGHT = 1 |
const Int |
VERTICAL_PATH_X = 4 |
const Int |
VERTICAL_PATH_Y = 5 |
Public constructors |
|---|
Motion(view: MotionWidget!) |
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(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 |
|
MotionPaths! |
getKeyFrame(i: Int)provides access to MotionPath objects |
Int |
getKeyFrameInfo(type: Int, info: IntArray!)Gets the keyFrames for the view controlled by this MotionController. |
Int |
getKeyFramePositions(type: IntArray!, pos: FloatArray!)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! |
getView() |
Boolean |
interpolate(The main driver of interpolation |
Unit |
setDrawPath(debugMode: Int) |
Unit |
setEnd(mw: MotionWidget!) |
Unit |
setIdString(stringId: String!) |
Unit |
setPathMotionArc(arc: Int) |
Unit |
setStaggerOffset(staggerOffset: Float)set the offset used in calculating stagger launches |
Unit |
setStaggerScale(staggerScale: Float)Set stagger scale |
Unit |
setStart(mw: MotionWidget!) |
Unit |
setStartState( |
Unit |
setTransformPivotTarget(transformPivotTarget: Int)Set a view to pivot around |
Boolean |
Used to set boolean values |
Boolean |
Used to set float values |
Boolean |
Used to set integer values |
Boolean |
Used to set String values |
Unit |
setView(view: MotionWidget!) |
Unit |
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! |
toString()Debug string |
Inherited Constants |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
Public constructors
Public functions
buildKeyFrames
fun buildKeyFrames(keyFrames: FloatArray!, mode: IntArray!, pos: IntArray!): Int
buildPath
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 |
getAnimateRelativeTo
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 |
getDpDt
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 |
getFinalHeight
fun getFinalHeight(): Float
get the width of the widget at the end of the movement.
| Returns | |
|---|---|
Float |
the height at the end |
getFinalWidth
fun getFinalWidth(): Float
get the width of the widget at the end of the movement.
| Returns | |
|---|---|
Float |
the width at the end |
getFinalX
fun getFinalX(): Float
get the left most position of the widget at the end of the movement.
| Returns | |
|---|---|
Float |
the left most position |
getFinalY
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 |
getKeyFrame
fun getKeyFrame(i: Int): MotionPaths!
provides access to MotionPath objects
getKeyFrameInfo
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
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
fun getMotionStagger(): Float
The values set in motion: { stagger: '2' }
| Returns | |
|---|---|
Float |
value from motion: { stagger: ? } or NaN if not set |
getStartHeight
fun getStartHeight(): Float
get the width of the widget at the start of the movement.
| Returns | |
|---|---|
Float |
the height at the start |
getStartWidth
fun getStartWidth(): Float
get the width of the widget at the start of the movement.
| Returns | |
|---|---|
Float |
the width at the start |
getStartX
fun getStartX(): Float
get the left most position of the widget at the start of the movement.
| Returns | |
|---|---|
Float |
the left most position |
getStartY
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
fun getTransformPivotTarget(): Int
Get the view to pivot around
| Returns | |
|---|---|
Int |
id of view or UNSET if not set |
interpolate
fun interpolate(
child: MotionWidget!,
globalPosition: Float,
time: Long,
keyCache: KeyCache!
): Boolean
The main driver of interpolation
| Returns | |
|---|---|
Boolean |
do you need to keep animating |
setStaggerOffset
fun setStaggerOffset(staggerOffset: Float): Unit
set the offset used in calculating stagger launches
| Parameters | |
|---|---|
staggerOffset: Float |
fraction of progress before this controller runs |
setStartState
fun setStartState(
rect: ViewState!,
v: MotionWidget!,
rotation: Int,
preWidth: Int,
preHeight: Int
): Unit
setTransformPivotTarget
fun setTransformPivotTarget(transformPivotTarget: Int): Unit
Set a view to pivot around
| Parameters | |
|---|---|
transformPivotTarget: Int |
id of view |
setValue
fun setValue(id: Int, value: Boolean): Boolean
Used to set boolean values
| Returns | |
|---|---|
Boolean |
true if it accepted the value |
setValue
fun setValue(id: Int, value: Float): Boolean
Used to set float values
| Returns | |
|---|---|
Boolean |
true if it accepted the value |
setValue
fun setValue(id: Int, value: Int): Boolean
Used to set integer values
| Returns | |
|---|---|
Boolean |
true if it accepted the value |
setValue
fun setValue(id: Int, value: String!): Boolean
Used to set String values
| Returns | |
|---|---|
Boolean |
true if it accepted the value |
setup
fun setup(
parentWidth: Int,
parentHeight: Int,
transitionDuration: Float,
currentTime: Long
): Unit
Called after all TimePoints &Cycles have been added; Spines are evaluated
setupRelative
fun setupRelative(motionController: Motion!): Unit
set up the motion to be relative to this other motionController