MotionScene.Transition
public
static
class
MotionScene.Transition
extends Object
java.lang.Object | |
↳ | androidx.constraintlayout.motion.widget.MotionScene.Transition |
Transition defines the interaction from one state to another. With out a Transition object Transition between two stats involves strictly linear interpolation
Summary
Nested classes | |
---|---|
class |
MotionScene.Transition.TransitionOnClick
|
Constants | |
---|---|
int |
AUTO_ANIMATE_TO_END
|
int |
AUTO_ANIMATE_TO_START
|
int |
AUTO_JUMP_TO_END
|
int |
AUTO_JUMP_TO_START
|
int |
AUTO_NONE
|
Public constructors | |
---|---|
Transition(int id, MotionScene motionScene, int constraintSetStartId, int constraintSetEndId)
Create a transition |
Public methods | |
---|---|
void
|
addKeyFrame(KeyFrames keyFrames)
|
void
|
addOnClick(Context context, XmlPullParser parser)
|
void
|
addOnClick(int id, int action)
|
String
|
debugString(Context context)
Print a debug string indicating the starting and ending state of the transition |
int
|
getAutoTransition()
return the autoTransitionType. |
int
|
getDuration()
gets the default transition duration |
int
|
getEndConstraintSetId()
Get the id of the constraint set to go to |
int
|
getId()
Transitions can be given and ID. |
List<KeyFrames>
|
getKeyFrameList()
|
int
|
getLayoutDuringTransition()
|
List<MotionScene.Transition.TransitionOnClick>
|
getOnClickList()
Get the onClick handlers. |
int
|
getPathMotionArc()
gets the pathMotionArc for the all motions in this transition. |
float
|
getStagger()
Gets the stagger value. |
int
|
getStartConstraintSetId()
Gets the id of the starting constraint set |
TouchResponse
|
getTouchResponse()
Get the Touch response manager |
boolean
|
isEnabled()
Returns true if this Transition can be auto considered for transition Default is enabled |
boolean
|
isTransitionFlag(int flag)
|
void
|
removeOnClick(int id)
|
void
|
setAutoTransition(int type)
sets the autoTransitionType On reaching a state auto transitions may be run based on one of AUTO_NONE, AUTO_JUMP_TO_START, AUTO_JUMP_TO_END, AUTO_ANIMATE_TO_START, AUTO_ANIMATE_TO_END |
void
|
setDuration(int duration)
sets the duration of the transition if set to < 8 it will be set to 8 |
void
|
setEnable(boolean enable)
This method is deprecated.
This method should be called |
void
|
setEnabled(boolean enable)
enable or disable the Transition. |
void
|
setInterpolatorInfo(int interpolator, String interpolatorString, int interpolatorID)
|
void
|
setLayoutDuringTransition(int mode)
|
void
|
setOnSwipe(OnSwipe onSwipe)
|
void
|
setOnTouchUp(int touchUpMode)
|
void
|
setPathMotionArc(int arcMode)
Sets the pathMotionArc for the all motions in this transition. |
void
|
setStagger(float stagger)
Sets the stagger value. |
void
|
setTransitionFlag(int flag)
|
Inherited methods | |
---|---|
Constants
AUTO_ANIMATE_TO_END
public static final int AUTO_ANIMATE_TO_END
Constant Value: 4 (0x00000004)
AUTO_ANIMATE_TO_START
public static final int AUTO_ANIMATE_TO_START
Constant Value: 3 (0x00000003)
AUTO_JUMP_TO_END
public static final int AUTO_JUMP_TO_END
Constant Value: 2 (0x00000002)
AUTO_JUMP_TO_START
public static final int AUTO_JUMP_TO_START
Constant Value: 1 (0x00000001)
AUTO_NONE
public static final int AUTO_NONE
Constant Value: 0 (0x00000000)
Public constructors
Transition
public Transition (int id, MotionScene motionScene, int constraintSetStartId, int constraintSetEndId)
Create a transition
Parameters | |
---|---|
id |
int : a unique id to represent the transition. |
motionScene |
MotionScene : the motion scene that the transition will be added to. |
constraintSetStartId |
int : id of the ConstraintSet to be used for the start of
transition |
constraintSetEndId |
int : id of the ConstraintSet to be used for the end of transition
|
Public methods
addOnClick
public void addOnClick (Context context, XmlPullParser parser)
Parameters | |
---|---|
context |
Context |
parser |
XmlPullParser |
addOnClick
public void addOnClick (int id, int action)
Parameters | |
---|---|
id |
int |
action |
int |
debugString
public String debugString (Context context)
Print a debug string indicating the starting and ending state of the transition
Returns | |
---|---|
String |
getAutoTransition
public int getAutoTransition ()
return the autoTransitionType. one of AUTO_NONE, AUTO_JUMP_TO_START, AUTO_JUMP_TO_END, AUTO_ANIMATE_TO_START, AUTO_ANIMATE_TO_END
Returns | |
---|---|
int |
0=NONE, 1=JUMP_TO_START, 2=JUMP_TO_END, 3=ANIMATE_TO_START, 4=ANIMATE_TO_END |
getDuration
public int getDuration ()
gets the default transition duration
Returns | |
---|---|
int |
duration int milliseconds |
getEndConstraintSetId
public int getEndConstraintSetId ()
Get the id of the constraint set to go to
Returns | |
---|---|
int |
getId
public int getId ()
Transitions can be given and ID. If unset it returns UNSET (-1)
Returns | |
---|---|
int |
The Id of the Transition set in the MotionScene File or UNSET (-1) |
getLayoutDuringTransition
public int getLayoutDuringTransition ()
Returns | |
---|---|
int |
getOnClickList
public List<MotionScene.Transition.TransitionOnClick> getOnClickList ()
Get the onClick handlers.
Returns | |
---|---|
List<MotionScene.Transition.TransitionOnClick> |
list of on click handler |
getPathMotionArc
public int getPathMotionArc ()
gets the pathMotionArc for the all motions in this transition. if set to UNSET (default) it reverts to the setting of the constraintSet
Returns | |
---|---|
int |
arcMode |
getStagger
public float getStagger ()
Gets the stagger value.
Returns | |
---|---|
float |
getStartConstraintSetId
public int getStartConstraintSetId ()
Gets the id of the starting constraint set
Returns | |
---|---|
int |
getTouchResponse
public TouchResponse getTouchResponse ()
Get the Touch response manager
Returns | |
---|---|
TouchResponse |
isEnabled
public boolean isEnabled ()
Returns true if this Transition can be auto considered for transition Default is enabled
Returns | |
---|---|
boolean |
isTransitionFlag
public boolean isTransitionFlag (int flag)
Parameters | |
---|---|
flag |
int |
Returns | |
---|---|
boolean |
removeOnClick
public void removeOnClick (int id)
Parameters | |
---|---|
id |
int |
setAutoTransition
public void setAutoTransition (int type)
sets the autoTransitionType On reaching a state auto transitions may be run based on one of AUTO_NONE, AUTO_JUMP_TO_START, AUTO_JUMP_TO_END, AUTO_ANIMATE_TO_START, AUTO_ANIMATE_TO_END
Parameters | |
---|---|
type |
int |
Returns | |
---|---|
void |
0=NONE, 1=JUMP_TO_START, 2=JUMP_TO_END, 3=ANIMATE_TO_START, 4=ANIMATE_TO_END |
setDuration
public void setDuration (int duration)
sets the duration of the transition if set to < 8 it will be set to 8
Parameters | |
---|---|
duration |
int : in milliseconds (min is 8)
|
setEnable
public void setEnable (boolean enable)
This method is deprecated.
This method should be called setEnabled
, so that isEnabled
can be accessed as a property from Kotlin.
Use setEnabled(boolean)
instead.
Enable or disable the Transition. If a Transition is disabled it is not eligible for automatically switching to.
setEnabled
public void setEnabled (boolean enable)
enable or disable the Transition. If a Transition is disabled it is not eligible for automatically switching to.
setInterpolatorInfo
public void setInterpolatorInfo (int interpolator, String interpolatorString, int interpolatorID)
Parameters | |
---|---|
interpolator |
int |
interpolatorString |
String |
interpolatorID |
int |
setLayoutDuringTransition
public void setLayoutDuringTransition (int mode)
Parameters | |
---|---|
mode |
int |
setOnTouchUp
public void setOnTouchUp (int touchUpMode)
Parameters | |
---|---|
touchUpMode |
int |
setPathMotionArc
public void setPathMotionArc (int arcMode)
Sets the pathMotionArc for the all motions in this transition. if set to UNSET (default) it reverts to the setting of the constraintSet
setStagger
public void setStagger (float stagger)
Sets the stagger value. A Stagger value of zero means no stagger. A Stagger value of 1 means the last view starts moving at .5 progress
setTransitionFlag
public void setTransitionFlag (int flag)
Parameters | |
---|---|
flag |
int |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-01-24 UTC.