public class Transition implements TypedValues


Summary

Nested types

Constants

static final int
END = 1
static final int
static final int
START = 0

Public constructors

Public methods

void
addCustomColor(int state, String widgetId, String property, int color)
void
addCustomFloat(int state, String widgetId, String property, float value)
void
void
addKeyAttribute(
    String target,
    TypedBundle bundle,
    CustomVariable[] custom
)

Add a key attribute and the custom variables into the

void
addKeyCycle(String target, TypedBundle bundle)
void
addKeyPosition(String target, TypedBundle bundle)
void
addKeyPosition(String target, int frame, int type, float x, float y)
void
void
boolean
float
dragToProgress(
    float currentProgress,
    int baseW,
    int baseH,
    float dx,
    float dy
)

Converts from xy drag to progress This should be used till touch up

void
fillKeyPositions(WidgetFrame frame, float[] x, float[] y, float[] pos)
Transition.KeyPosition
findNextPosition(String target, int frameNumber)
Transition.KeyPosition
findPreviousPosition(String target, int frameNumber)
int

This gets the auto transition mode being used

WidgetFrame

Used in debug draw

WidgetFrame
int
getId(String name)
WidgetFrame

Used after the interpolation

WidgetFrame
int
int
Interpolator

This gets the interpolator being used

static Interpolator
getInterpolator(int interpolator, String interpolatorString)

get the interpolater based on a constant or a string

int
getKeyFrames(
    String id,
    float[] rectangles,
    int[] pathMode,
    int[] position
)
Motion
int
float[]
WidgetFrame

Used in debug draw

WidgetFrame
float
getTouchUpProgress(long currentTime)

get the current touch up progress current time in nanoseconds (ideally coming from an animation clock)

Transition.WidgetState
getWidgetState(
    String widgetId,
    ConstraintWidget child,
    int transitionState
)
boolean
boolean
void
interpolate(int parentWidth, int parentHeight, float progress)
boolean
boolean
isTouchNotDone(float currentProgress)

Are we still animating

void
setTouchUp(
    float currentProgress,
    long currentTime,
    float velocityX,
    float velocityY
)

Set the start of the touch up

void
boolean
setValue(int id, boolean value)

Used to set boolean values

boolean
setValue(int id, float value)

Used to set float values

boolean
setValue(int id, int value)

Used to set integer values

boolean
setValue(int id, String value)

Used to set String values

void
updateFrom(ConstraintWidgetContainer container, int state)

Update container of parameters for the state

Inherited Constants

From androidx.constraintlayout.core.motion.utils.TypedValues
static final int
static final int
static final int
static final int
static final String
S_CUSTOM = "CUSTOM"
static final int
static final int

Constants

END

Added in 1.1.0
public static final int END = 1

INTERPOLATED

Added in 1.1.0
public static final int INTERPOLATED = 2

START

Added in 1.1.0
public static final int START = 0

Public constructors

Transition

Added in 1.1.0
public Transition(@NonNull CorePixelDp dpToPixel)

Public methods

addCustomColor

Added in 1.1.0
public void addCustomColor(int state, String widgetId, String property, int color)

addCustomFloat

Added in 1.1.0
public void addCustomFloat(int state, String widgetId, String property, float value)

addKeyAttribute

Added in 1.1.0
public void addKeyAttribute(String target, TypedBundle bundle)

addKeyAttribute

Added in 1.1.0
public void addKeyAttribute(
    String target,
    TypedBundle bundle,
    CustomVariable[] custom
)

Add a key attribute and the custom variables into the

Parameters
String target

the id of the target

TypedBundle bundle

the key attributes bundle containing position etc.

CustomVariable[] custom

the customVariables to add at that position

addKeyCycle

Added in 1.1.0
public void addKeyCycle(String target, TypedBundle bundle)

addKeyPosition

Added in 1.1.0
public void addKeyPosition(String target, TypedBundle bundle)

addKeyPosition

Added in 1.1.0
public void addKeyPosition(String target, int frame, int type, float x, float y)

calcStagger

Added in 1.1.0
public void calcStagger()

clear

Added in 1.1.0
public void clear()

contains

Added in 1.1.0
public boolean contains(String key)

dragToProgress

Added in 1.1.0
public float dragToProgress(
    float currentProgress,
    int baseW,
    int baseH,
    float dx,
    float dy
)

Converts from xy drag to progress This should be used till touch up

Parameters
int baseW

parent width

int baseH

parent height

float dx

change in x

float dy

change in y

Returns
float

the change in progress

fillKeyPositions

Added in 1.1.0
public void fillKeyPositions(WidgetFrame frame, float[] x, float[] y, float[] pos)

findNextPosition

Added in 1.1.0
public Transition.KeyPosition findNextPosition(String target, int frameNumber)

findPreviousPosition

Added in 1.1.0
public Transition.KeyPosition findPreviousPosition(String target, int frameNumber)

getAutoTransition

Added in 1.1.0
public int getAutoTransition()

This gets the auto transition mode being used

getEnd

Added in 1.1.0
public WidgetFrame getEnd(ConstraintWidget child)

Used in debug draw

getEnd

Added in 1.1.0
public WidgetFrame getEnd(String id)

getId

Added in 1.1.0
public int getId(String name)

getInterpolated

Added in 1.1.0
public WidgetFrame getInterpolated(ConstraintWidget child)

Used after the interpolation

getInterpolated

Added in 1.1.0
public WidgetFrame getInterpolated(String id)

getInterpolatedHeight

Added in 1.1.0
public int getInterpolatedHeight()

getInterpolatedWidth

Added in 1.1.0
public int getInterpolatedWidth()

getInterpolator

Added in 1.1.0
public Interpolator getInterpolator()

This gets the interpolator being used

getInterpolator

Added in 1.1.0
public static Interpolator getInterpolator(int interpolator, String interpolatorString)

get the interpolater based on a constant or a string

getKeyFrames

Added in 1.1.0
public int getKeyFrames(
    String id,
    float[] rectangles,
    int[] pathMode,
    int[] position
)

getMotion

Added in 1.1.0
public Motion getMotion(String id)

getNumberKeyPositions

Added in 1.1.0
public int getNumberKeyPositions(WidgetFrame frame)

getPath

Added in 1.1.0
public float[] getPath(String id)

getStart

Added in 1.1.0
public WidgetFrame getStart(ConstraintWidget child)

Used in debug draw

getStart

Added in 1.1.0
public WidgetFrame getStart(String id)

getTouchUpProgress

Added in 1.1.0
public float getTouchUpProgress(long currentTime)

get the current touch up progress current time in nanoseconds (ideally coming from an animation clock)

Parameters
long currentTime

in nanoseconds

Returns
float

progress

getWidgetState

Added in 1.1.0
public Transition.WidgetState getWidgetState(
    String widgetId,
    ConstraintWidget child,
    int transitionState
)

hasOnSwipe

Added in 1.1.0
public boolean hasOnSwipe()

hasPositionKeyframes

Added in 1.1.0
public boolean hasPositionKeyframes()

interpolate

Added in 1.1.0
public void interpolate(int parentWidth, int parentHeight, float progress)

isEmpty

Added in 1.1.0
public boolean isEmpty()

isTouchNotDone

Added in 1.1.0
public boolean isTouchNotDone(float currentProgress)

Are we still animating

Parameters
float currentProgress

motion progress

Returns
boolean

true to continue moving

setTouchUp

Added in 1.1.0
public void setTouchUp(
    float currentProgress,
    long currentTime,
    float velocityX,
    float velocityY
)

Set the start of the touch up

Parameters
float currentProgress

0...1 progress in

long currentTime

time in nanoseconds

float velocityX

pixels per millisecond

float velocityY

pixels per millisecond

setTransitionProperties

Added in 1.1.0
public void setTransitionProperties(TypedBundle bundle)

setValue

Added in 1.1.0
public boolean setValue(int id, boolean value)

Used to set boolean values

Returns
boolean

true if it accepted the value

setValue

Added in 1.1.0
public boolean setValue(int id, float value)

Used to set float values

Returns
boolean

true if it accepted the value

setValue

Added in 1.1.0
public boolean setValue(int id, int value)

Used to set integer values

Returns
boolean

true if it accepted the value

setValue

Added in 1.1.0
public boolean setValue(int id, String value)

Used to set String values

Returns
boolean

true if it accepted the value

updateFrom

Added in 1.1.0
public void updateFrom(ConstraintWidgetContainer container, int state)

Update container of parameters for the state

Parameters
ConstraintWidgetContainer container

contains all the widget parameters

int state

starting or ending