Added in API level 1

TranslateAnimation


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

An animation that controls the position of an object. See the full package description for details and sample code.

Summary

Inherited constants
Public constructors

Constructor used when a TranslateAnimation is loaded from a resource.

TranslateAnimation(fromXDelta: Float, toXDelta: Float, fromYDelta: Float, toYDelta: Float)

Constructor to use when building a TranslateAnimation from code

TranslateAnimation(fromXType: Int, fromXValue: Float, toXType: Int, toXValue: Float, fromYType: Int, fromYValue: Float, toYType: Int, toYValue: Float)

Constructor to use when building a TranslateAnimation from code

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

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

Inherited functions

Public constructors

TranslateAnimation

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

Constructor used when a TranslateAnimation is loaded from a resource.

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

TranslateAnimation

Added in API level 1
TranslateAnimation(
    fromXDelta: Float,
    toXDelta: Float,
    fromYDelta: Float,
    toYDelta: Float)

Constructor to use when building a TranslateAnimation from code

Parameters
fromXDelta Float: Change in X coordinate to apply at the start of the animation
toXDelta Float: Change in X coordinate to apply at the end of the animation
fromYDelta Float: Change in Y coordinate to apply at the start of the animation
toYDelta Float: Change in Y coordinate to apply at the end of the animation

TranslateAnimation

Added in API level 1
TranslateAnimation(
    fromXType: Int,
    fromXValue: Float,
    toXType: Int,
    toXValue: Float,
    fromYType: Int,
    fromYValue: Float,
    toYType: Int,
    toYValue: Float)

Constructor to use when building a TranslateAnimation from code

Parameters
fromXType Int: Specifies how fromXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
fromXValue Float: Change in X coordinate to apply at the start of the animation. This value can either be an absolute number if fromXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
toXType Int: Specifies how toXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
toXValue Float: Change in X coordinate to apply at the end of the animation. This value can either be an absolute number if toXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
fromYType Int: Specifies how fromYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
fromYValue Float: Change in Y coordinate to apply at the start of the animation. This value can either be an absolute number if fromYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
toYType Int: Specifies how toYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT.
toYValue Float: Change in Y coordinate to apply at the end of the animation. This value can either be an absolute number if toYType 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
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
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.