Transition
public class Transition implements TypedValues
Summary
Nested types |
|---|
public class Transition.WidgetState |
Constants |
|
|---|---|
static final int |
END = 1 |
static final int |
INTERPOLATED = 2 |
static final int |
START = 0 |
Public constructors |
|---|
Transition(@NonNull CorePixelDp dpToPixel) |
Public methods |
|
|---|---|
void |
addCustomColor(int state, String widgetId, String property, int color) |
void |
addCustomFloat(int state, String widgetId, String property, float value) |
void |
addKeyAttribute(String target, TypedBundle bundle) |
void |
addKeyAttribute(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 |
clear() |
boolean |
|
float |
dragToProgress(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 |
getEnd(ConstraintWidget child)Used in debug draw |
WidgetFrame |
|
int |
|
WidgetFrame |
getInterpolated(ConstraintWidget child)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( |
Motion |
|
int |
getNumberKeyPositions(WidgetFrame frame) |
float[] |
|
WidgetFrame |
getStart(ConstraintWidget child)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( |
boolean |
|
boolean |
|
void |
interpolate(int parentWidth, int parentHeight, float progress) |
boolean |
isEmpty() |
boolean |
isTouchNotDone(float currentProgress)Are we still animating |
void |
setTouchUp(Set the start of the touch up |
void |
setTransitionProperties(TypedBundle bundle) |
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 |
Used to set String values |
void |
updateFrom(ConstraintWidgetContainer container, int state)Update container of parameters for the state |
Inherited Constants |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
Public constructors
Public methods
addCustomColor
public void addCustomColor(int state, String widgetId, String property, int color)
addCustomFloat
public void addCustomFloat(int state, String widgetId, String property, float value)
addKeyAttribute
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 |
addKeyPosition
public void addKeyPosition(String target, int frame, int type, float x, float y)
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 | |
|---|---|
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
public void fillKeyPositions(WidgetFrame frame, float[] x, float[] y, float[] pos)
findNextPosition
public Transition.KeyPosition findNextPosition(String target, int frameNumber)
findPreviousPosition
public Transition.KeyPosition findPreviousPosition(String target, int frameNumber)
getAutoTransition
public int getAutoTransition()
This gets the auto transition mode being used
getInterpolated
public WidgetFrame getInterpolated(ConstraintWidget child)
Used after the interpolation
getInterpolator
public Interpolator getInterpolator()
This gets the interpolator being used
getInterpolator
public static Interpolator getInterpolator(int interpolator, String interpolatorString)
get the interpolater based on a constant or a string
getKeyFrames
public int getKeyFrames(
String id,
float[] rectangles,
int[] pathMode,
int[] position
)
getTouchUpProgress
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
public Transition.WidgetState getWidgetState(
String widgetId,
ConstraintWidget child,
int transitionState
)
interpolate
public void interpolate(int parentWidth, int parentHeight, float progress)
isTouchNotDone
public boolean isTouchNotDone(float currentProgress)
Are we still animating
| Parameters | |
|---|---|
float currentProgress |
motion progress |
| Returns | |
|---|---|
boolean |
true to continue moving |
setTouchUp
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 |
setValue
public boolean setValue(int id, boolean value)
Used to set boolean values
| Returns | |
|---|---|
boolean |
true if it accepted the value |
setValue
public boolean setValue(int id, float value)
Used to set float values
| Returns | |
|---|---|
boolean |
true if it accepted the value |
setValue
public boolean setValue(int id, int value)
Used to set integer values
| Returns | |
|---|---|
boolean |
true if it accepted the value |
setValue
public boolean setValue(int id, String value)
Used to set String values
| Returns | |
|---|---|
boolean |
true if it accepted the value |
updateFrom
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 |