Class Transition
- java.lang.Object
-
- androidx.constraintlayout.core.state.Transition
-
- All Implemented Interfaces:
TypedValues
public class Transition extends java.lang.Object implements TypedValues
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface androidx.constraintlayout.core.motion.utils.TypedValues
TypedValues.AttributesType, TypedValues.Custom, TypedValues.CycleType, TypedValues.MotionScene, TypedValues.MotionType, TypedValues.PositionType, TypedValues.TransitionType, TypedValues.TriggerType
-
-
Field Summary
Fields Modifier and Type Field Description static intENDstatic intINTERPOLATEDstatic intSTART-
Fields inherited from interface androidx.constraintlayout.core.motion.utils.TypedValues
BOOLEAN_MASK, FLOAT_MASK, INT_MASK, S_CUSTOM, STRING_MASK, TYPE_FRAME_POSITION, TYPE_TARGET
-
-
Constructor Summary
Constructors Constructor Description Transition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCustomColor(int state, java.lang.String widgetId, java.lang.String property, int color)voidaddCustomFloat(int state, java.lang.String widgetId, java.lang.String property, float value)voidaddKeyAttribute(java.lang.String target, TypedBundle bundle)voidaddKeyCycle(java.lang.String target, TypedBundle bundle)voidaddKeyPosition(java.lang.String target, int frame, int type, float x, float y)voidaddKeyPosition(java.lang.String target, TypedBundle bundle)voidcalcStagger()voidclear()booleancontains(java.lang.String key)floatdragToProgress(float currentProgress, int baseW, int baseH, float dx, float dy)Converts from xy drag to progress This should be used till touch upvoidfillKeyPositions(WidgetFrame frame, float[] x, float[] y, float[] pos)androidx.constraintlayout.core.state.Transition.KeyPositionfindNextPosition(java.lang.String target, int frameNumber)androidx.constraintlayout.core.state.Transition.KeyPositionfindPreviousPosition(java.lang.String target, int frameNumber)intgetAutoTransition()This gets the auto transition mode being usedWidgetFramegetEnd(ConstraintWidget child)Used in debug drawWidgetFramegetEnd(java.lang.String id)intgetId(java.lang.String name)WidgetFramegetInterpolated(ConstraintWidget child)Used after the interpolationWidgetFramegetInterpolated(java.lang.String id)InterpolatorgetInterpolator()This gets the interpolator being usedstatic InterpolatorgetInterpolator(int interpolator, java.lang.String interpolatorString)get the interpolater based on a constant or a stringintgetKeyFrames(java.lang.String id, float[] rectangles, int[] pathMode, int[] position)MotiongetMotion(java.lang.String id)intgetNumberKeyPositions(WidgetFrame frame)float[]getPath(java.lang.String id)WidgetFramegetStart(ConstraintWidget child)Used in debug drawWidgetFramegetStart(java.lang.String id)floatgetTouchUpProgress(long currentTime)get the current touch up progress current time in nanoseconds (ideally coming from an animation clock)booleanhasOnSwipe()booleanhasPositionKeyframes()voidinterpolate(int parentWidth, int parentHeight, float progress)booleanisEmpty()booleanisTouchNotDone(float currentProgress)Are we still animatingvoidsetTouchUp(float currentProgress, long currentTime, float velocityX, float velocityY)Set the start of the touch upvoidsetTransitionProperties(TypedBundle bundle)booleansetValue(int id, boolean value)Used to set boolean valuesbooleansetValue(int id, float value)Used to set float valuesbooleansetValue(int id, int value)Used to set integer valuesbooleansetValue(int id, java.lang.String value)Used to set String valuesvoidupdateFrom(ConstraintWidgetContainer container, int state)Update container of parameters for the state
-
-
-
Field Detail
-
START
public static final int START
- See Also:
- Constant Field Values
-
END
public static final int END
- See Also:
- Constant Field Values
-
INTERPOLATED
public static final int INTERPOLATED
- See Also:
- Constant Field Values
-
-
Method Detail
-
hasOnSwipe
public boolean hasOnSwipe()
-
dragToProgress
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:
baseW- parent widthbaseH- parent heightdx- change in xdy- change in y- Returns:
- the change in progress
-
setTouchUp
public void setTouchUp(float currentProgress, long currentTime, float velocityX, float velocityY)Set the start of the touch up- Parameters:
currentProgress- 0...1 progress incurrentTime- time in nanosecondsvelocityX- pixels per millisecondvelocityY- pixels per millisecond
-
getTouchUpProgress
public float getTouchUpProgress(long currentTime)
get the current touch up progress current time in nanoseconds (ideally coming from an animation clock)- Parameters:
currentTime- in nanoseconds- Returns:
- progress
-
isTouchNotDone
public boolean isTouchNotDone(float currentProgress)
Are we still animating- Parameters:
currentProgress- motion progress- Returns:
- true to continue moving
-
getInterpolator
public static Interpolator getInterpolator(int interpolator, java.lang.String interpolatorString)
get the interpolater based on a constant or a string
-
findPreviousPosition
public androidx.constraintlayout.core.state.Transition.KeyPosition findPreviousPosition(java.lang.String target, int frameNumber)
-
findNextPosition
public androidx.constraintlayout.core.state.Transition.KeyPosition findNextPosition(java.lang.String target, int frameNumber)
-
getNumberKeyPositions
public int getNumberKeyPositions(WidgetFrame frame)
-
getMotion
public Motion getMotion(java.lang.String id)
-
fillKeyPositions
public void fillKeyPositions(WidgetFrame frame, float[] x, float[] y, float[] pos)
-
hasPositionKeyframes
public boolean hasPositionKeyframes()
-
setTransitionProperties
public void setTransitionProperties(TypedBundle bundle)
-
setValue
public boolean setValue(int id, int value)Description copied from interface:TypedValuesUsed to set integer values- Specified by:
setValuein interfaceTypedValues- Returns:
- true if it accepted the value
-
setValue
public boolean setValue(int id, float value)Description copied from interface:TypedValuesUsed to set float values- Specified by:
setValuein interfaceTypedValues- Returns:
- true if it accepted the value
-
setValue
public boolean setValue(int id, java.lang.String value)Description copied from interface:TypedValuesUsed to set String values- Specified by:
setValuein interfaceTypedValues- Returns:
- true if it accepted the value
-
setValue
public boolean setValue(int id, boolean value)Description copied from interface:TypedValuesUsed to set boolean values- Specified by:
setValuein interfaceTypedValues- Returns:
- true if it accepted the value
-
getId
public int getId(java.lang.String name)
- Specified by:
getIdin interfaceTypedValues
-
isEmpty
public boolean isEmpty()
-
clear
public void clear()
-
contains
public boolean contains(java.lang.String key)
-
addKeyPosition
public void addKeyPosition(java.lang.String target, TypedBundle bundle)
-
addKeyAttribute
public void addKeyAttribute(java.lang.String target, TypedBundle bundle)
-
addKeyCycle
public void addKeyCycle(java.lang.String target, TypedBundle bundle)
-
addKeyPosition
public void addKeyPosition(java.lang.String target, int frame, int type, float x, float y)
-
addCustomFloat
public void addCustomFloat(int state, java.lang.String widgetId, java.lang.String property, float value)
-
addCustomColor
public void addCustomColor(int state, java.lang.String widgetId, java.lang.String property, int color)
-
updateFrom
public void updateFrom(ConstraintWidgetContainer container, int state)
Update container of parameters for the state- Parameters:
container- contains all the widget parametersstate- starting or ending
-
interpolate
public void interpolate(int parentWidth, int parentHeight, float progress)
-
getStart
public WidgetFrame getStart(java.lang.String id)
-
getEnd
public WidgetFrame getEnd(java.lang.String id)
-
getInterpolated
public WidgetFrame getInterpolated(java.lang.String id)
-
getPath
public float[] getPath(java.lang.String id)
-
getKeyFrames
public int getKeyFrames(java.lang.String id, float[] rectangles, int[] pathMode, int[] position)
-
getStart
public WidgetFrame getStart(ConstraintWidget child)
Used in debug draw
-
getEnd
public WidgetFrame getEnd(ConstraintWidget child)
Used in debug draw
-
getInterpolated
public WidgetFrame getInterpolated(ConstraintWidget child)
Used after the interpolation
-
getInterpolator
public Interpolator getInterpolator()
This gets the interpolator being used
-
getAutoTransition
public int getAutoTransition()
This gets the auto transition mode being used
-
calcStagger
public void calcStagger()
-
-