public class Scale extends Visibility
Visibility transition implementation that tracks changes to the visibility of target
views in the start and end scenes and scales up or down views in the scene. Visibility is
determined by both the View.setVisibility(int) state of the view as well as whether it
is parented in the current view hierarchy. Disappearing Views are limited as described in
Visibility.onDisappear(android.view.ViewGroup, TransitionValues, int, TransitionValues, int).
Scaling pivot for both X and Y axes, as concrete positions, may be specified via setPivotX(Float)
and setPivotY(Float). In order too specify X and Y pivots as relative positions/fractions,
setPivotXFraction(float) along with setPivotYFraction(float) may be used.
Scale transition can be described in a resource file by using the transition tag with
class attribute set to universum.studios.android.transition.Scale, along with
Xml attributes referenced below.
Scale Attributes| Modifier and Type | Class and Description |
|---|---|
static interface |
Scale.ScaleMode
Defines an annotation for determining set of allowed modes for Scale transition.
|
Transition.EpicenterCallback, Transition.TransitionListener| Modifier and Type | Field and Description |
|---|---|
static TimeInterpolator |
INTERPOLATOR
Default interpolator attached to
Animator created via createAnimator(View, float, float, float, float). |
static float |
MAX
Maximum value for scale property
|
static float |
MIN
Minimum value for scale property.
|
static String |
PROPERTY_SCALE_X
Name of the view's property used to scale size of a specific view along its x axis.
|
static String |
PROPERTY_SCALE_Y
Name of the view's property used to scale size of a specific view along its y axis.
|
MODE_IN, MODE_OUTMATCH_ID, MATCH_INSTANCE, MATCH_ITEM_ID, MATCH_NAME| Constructor and Description |
|---|
Scale()
|
Scale(Context context,
AttributeSet attrs)
Creates a new instance of Scale transition with animation property values set from the
specified attrs.
|
Scale(int mode)
Creates a new instance of Scale transition with the specified mode.
|
| Modifier and Type | Method and Description |
|---|---|
void |
captureStartValues(TransitionValues transitionValues) |
static Animator |
createAnimator(View view,
float startScale,
float endScale)
Creates a new instance of Animator that animates both, scale X and scale Y, properties of
the specified view.
|
static Animator |
createAnimator(View view,
float startScaleX,
float startScaleY,
float endScaleX,
float endScaleY)
Creates a new instance of Animator that animates both, scale X and scale Y, properties of
the specified view.
|
Float |
getPivotX()
Returns the x coordinate for pivot of the scale animation.
|
float |
getPivotXFraction()
Returns the fraction of the pivot x coordinate.
|
Float |
getPivotY()
Returns the y coordinate for pivot of the scale animation.
|
float |
getPivotYFraction()
Returns the fraction of the pivot y coordinate.
|
Animator |
onAppear(ViewGroup sceneRoot,
View view,
TransitionValues startValues,
TransitionValues endValues) |
Animator |
onDisappear(ViewGroup sceneRoot,
View view,
TransitionValues startValues,
TransitionValues endValues) |
void |
setPivotX(Float pivotX)
Sets a pivot x coordinate for scale animation.
|
void |
setPivotXFraction(float fractionX)
Sets a fraction for the pivot x coordinate.
|
void |
setPivotY(Float pivotY)
Sets a pivot y coordinate for scale animation.
|
void |
setPivotYFraction(float fractionY)
Sets a fraction for the pivot y coordinate.
|
captureEndValues, createAnimator, getMode, getTransitionProperties, isTransitionRequired, isVisible, onAppear, onDisappear, setModeaddListener, addTarget, addTarget, addTarget, addTarget, canRemoveViews, clone, excludeChildren, excludeChildren, excludeChildren, excludeTarget, excludeTarget, excludeTarget, excludeTarget, getDuration, getEpicenter, getEpicenterCallback, getInterpolator, getName, getPathMotion, getPropagation, getStartDelay, getTargetIds, getTargetNames, getTargets, getTargetTypes, getTransitionValues, removeListener, removeTarget, removeTarget, removeTarget, removeTarget, setDuration, setEpicenterCallback, setInterpolator, setMatchOrder, setPathMotion, setPropagation, setStartDelay, toStringpublic static final float MIN
public static final float MAX
public static final String PROPERTY_SCALE_X
public static final String PROPERTY_SCALE_Y
public static final TimeInterpolator INTERPOLATOR
Animator created via createAnimator(View, float, float, float, float).public Scale()
public Scale(int mode)
mode - One of Visibility.MODE_IN or Visibility.MODE_OUT or theirs combination.public Scale(@NonNull Context context, @Nullable AttributeSet attrs)
context - Context used to obtain values from the specified attrs.attrs - Set of attributes from which to obtain animation property values for the scale
animation.@Nullable public static Animator createAnimator(@NonNull View view, float startScale, float endScale)
The returned animator will also have the default INTERPOLATOR attached.
view - The view for which to create the requested animator.startScale - Scale from which to start the animation along X and Y axis.endScale - Scale at which should the animation end along X and Y axis.null if the start and end scale values are the same.createAnimator(View, float, float, float, float)@Nullable public static Animator createAnimator(@NonNull View view, float startScaleX, float startScaleY, float endScaleX, float endScaleY)
The returned animator will also have the default INTERPOLATOR attached.
view - The view for which to create the requested animator.startScaleX - Scale from which to start the animation along X axis.startScaleY - Scale from which to start the animation along Y axis.endScaleX - Scale at which should the animation end along X axis.endScaleY - Scale at which should the animation end along Y axis.null if the start and end scale values are the
same or the target view is already detached from window.public void setPivotX(@Nullable Float pivotX)
Default value: null
pivotX - The desired pivot x coordinate in pixels. May be null to use pivot
fraction specified via setPivotXFraction(float) instead.getPivotX(),
setPivotXFraction(float),
setPivotY(Float),
android:transformPivotX@Nullable public Float getPivotX()
null if no pivot has been specified.setPivotX(Float)public void setPivotY(@Nullable Float pivotY)
Default value: null
pivotY - The desired pivot y coordinate in pixels. May be null to use pivot
fraction specified via setPivotYFraction(float) instead.getPivotY(),
setPivotYFraction(float),
setPivotX(Float),
android:transformPivotY@Nullable public Float getPivotY()
null if no pivot has been specified.setPivotY(Float)public void setPivotXFraction(float fractionX)
setPivotX(Float).
Default value: 0.5
fractionX - The desired fraction from the [0.0, 1.0] range.getPivotYFraction(),
setPivotXFraction(float),
setPivotX(Float),
android:pivotXpublic float getPivotXFraction()
[0.0, 1.0] range.setPivotXFraction(float)public void setPivotYFraction(float fractionY)
setPivotY(Float).
Default value: 0.5
fractionY - The desired fraction from the [0.0, 1.0] range.getPivotXFraction(),
setPivotYFraction(float),
setPivotY(Float),
android:pivotYpublic float getPivotYFraction()
[0.0, 1.0] range.setPivotYFraction(float)public void captureStartValues(@NonNull TransitionValues transitionValues)
captureStartValues in class Visibility@Nullable public Animator onAppear(@NonNull ViewGroup sceneRoot, @NonNull View view, @Nullable TransitionValues startValues, @Nullable TransitionValues endValues)
onAppear in class Visibility@Nullable public Animator onDisappear(@NonNull ViewGroup sceneRoot, @NonNull View view, @Nullable TransitionValues startValues, @Nullable TransitionValues endValues)
onDisappear in class Visibility