Added in API level 1

ScaleAnimation


open class ScaleAnimation : Animation
kotlin.Any
   ↳ android.view.animation.Animation
   ↳ android.view.animation.ScaleAnimation

An animation that controls the scale of an object. You can specify the point to use for the center of scaling.

Summary

Inherited constants
Public constructors
ScaleAnimation(context: Context!, attrs: AttributeSet!)

Constructor used when a ScaleAnimation is loaded from a resource.

ScaleAnimation(fromX: Float, toX: Float, fromY: Float, toY: Float)

Constructor to use when building a ScaleAnimation from code

ScaleAnimation(fromX: Float, toX: Float, fromY: Float, toY: Float, pivotX: Float, pivotY: Float)

Constructor to use when building a ScaleAnimation from code

ScaleAnimation(fromX: Float, toX: Float, fromY: Float, toY: Float, pivotXType: Int, pivotXValue: Float, pivotYType: Int, pivotYValue: Float)

Constructor to use when building a ScaleAnimation from code

Public methods
open Unit
initialize(width: Int, height: Int, parentWidth: Int, parentHeight: Int)

Initialize this animation with the dimensions of the object being animated as well as the objects parents.

Protected methods
open Unit
applyTransformation(interpolatedTime: Float, t: Transformation!)

Helper for getTransformation.

Inherited functions

Public constructors

ScaleAnimation

Added in API level 1
ScaleAnimation(
    context: Context!,
    attrs: AttributeSet!)

Constructor used when a ScaleAnimation is loaded from a resource.

Parameters
context Context!: Application context to use
attrs AttributeSet!: Attribute set from which to read values

ScaleAnimation

Added in API level 1
ScaleAnimation(
    fromX: Float,
    toX: Float,
    fromY: Float,
    toY: Float)

Constructor to use when building a ScaleAnimation from code

Parameters
fromX Float: Horizontal scaling factor to apply at the start of the animation
toX Float: Horizontal scaling factor to apply at the end of the animation
fromY Float: Vertical scaling factor to apply at the start of the animation
toY Float: Vertical scaling factor to apply at the end of the animation

ScaleAnimation

Added in API level 1
ScaleAnimation(
    fromX: Float,
    toX: Float,
    fromY: Float,
    toY: Float,
    pivotX: Float,
    pivotY: Float)

Constructor to use when building a ScaleAnimation from code

Parameters
fromX Float: Horizontal scaling factor to apply at the start of the animation
toX Float: Horizontal scaling factor to apply at the end of the animation
fromY Float: Vertical scaling factor to apply at the start of the animation
toY Float: Vertical scaling factor to apply at the end of the animation
pivotX Float: The X coordinate of the point about which the object is being scaled, specified as an absolute number where 0 is the left edge. (This point remains fixed while the object changes size.)
pivotY Float: The Y coordinate of the point about which the object is being scaled, specified as an absolute number where 0 is the top edge. (This point remains fixed while the object changes size.)

ScaleAnimation

Added in API level 1
ScaleAnimation(
    fromX: Float,
    toX: Float,
    fromY: Float,
    toY: Float,
    pivotXType: Int,
    pivotXValue: Float,
    pivotYType: Int,
    pivotYValue: Float)

Constructor to use when building a ScaleAnimation from code

Parameters
fromX Float: Horizontal scaling factor to apply at the start of the animation
toX Float: Horizontal scaling factor to apply at the end of the animation
fromY Float: Vertical scaling factor to apply at the start of the animation
toY Float: Vertical scaling factor to apply at the end of the animation
pivotXType Int: Specifies how pivotXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
pivotXValue Float: The X coordinate of the point about which the object is being scaled, specified as an absolute number where 0 is the left edge. (This point remains fixed while the object changes size.) This value can either be an absolute number if pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
pivotYType Int: Specifies how pivotYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
pivotYValue Float: The Y coordinate of the point about which the object is being scaled, specified as an absolute number where 0 is the top edge. (This point remains fixed while the object changes size.) This value can either be an absolute number if pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.

Public methods

initialize

Added in API level 1
open fun initialize(
    width: Int,
    height: Int,
    parentWidth: Int,
    parentHeight: Int
): Unit

Initialize this animation with the dimensions of the object being animated as well as the objects parents. (This is to support animation sizes being specified relative to these dimensions.)

Objects that interpret Animations should call this method when the sizes of the object being animated and its parent are known, and before calling #getTransformation.

Parameters
width Int: Width of the object being animated
height Int: Height of the object being animated
parentWidth Int: Width of the animated object's parent
parentHeight Int: Height of the animated object's parent

Protected methods

applyTransformation

Added in API level 1
protected open fun applyTransformation(
    interpolatedTime: Float,
    t: Transformation!
): Unit

Helper for getTransformation. Subclasses should implement this to apply their transforms given an interpolation value. Implementations of this method should always replace the specified Transformation or document they are doing otherwise.

Parameters
interpolatedTime Float: The value of the normalized time (0.0 to 1.0) after it has been run through the interpolation function.
t Transformation!: The Transformation object to fill in with the current transforms.