# Transformation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/view/animation/Transformation#constants)\|[Fields](https://developer.android.com/reference/android/view/animation/Transformation#lfields)\|[Ctors](https://developer.android.com/reference/android/view/animation/Transformation#pubctors)\|[Methods](https://developer.android.com/reference/android/view/animation/Transformation#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/view/animation/Transformation#inhmethods)  

# Transformation

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/view/animation/Transformation "View this page in Kotlin")\|Java

`
public


class
Transformation
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|---------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.animation.Transformation |

<br />

*** ** * ** ***

Defines the transformation to be applied at one point in time of an Animation.

## Summary

|                                                                                           ### Constants                                                                                            ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [TYPE_ALPHA](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_ALPHA) Indicates a transformation that applies an alpha only (uses an identity matrix.)     |
| `int` | [TYPE_BOTH](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_BOTH) Indicates a transformation that applies an alpha and a matrix.                         |
| `int` | [TYPE_IDENTITY](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_IDENTITY) Indicates a transformation that has no effect (alpha = 1 and identity matrix.) |
| `int` | [TYPE_MATRIX](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_MATRIX) Indicates a transformation that applies a matrix only (alpha = 1.)                 |

|                                                                                                       ### Fields                                                                                                        ||
|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| ` protected float`                                                                     | [mAlpha](https://developer.android.com/reference/android/view/animation/Transformation#mAlpha) <br />                           |
| ` protected `[Matrix](https://developer.android.com/reference/android/graphics/Matrix) | [mMatrix](https://developer.android.com/reference/android/view/animation/Transformation#mMatrix) <br />                         |
| ` protected int`                                                                       | [mTransformationType](https://developer.android.com/reference/android/view/animation/Transformation#mTransformationType) <br /> |

|                                                                                     ### Public constructors                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Transformation](https://developer.android.com/reference/android/view/animation/Transformation#Transformation())`() ` Creates a new transformation with alpha = 1 and the identity matrix. |

|                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                        ||
|------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                      | ` `[clear](https://developer.android.com/reference/android/view/animation/Transformation#clear())`() ` Reset the transformation to a state that leaves the object being animated in an unmodified state.                                                                                                                                                                          |
| ` void`                                                                      | ` `[compose](https://developer.android.com/reference/android/view/animation/Transformation#compose(android.view.animation.Transformation))`(`[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` t) ` Apply this Transformation to an existing Transformation, e.g. apply a scale effect to something that has already been rotated. |
| ` float`                                                                     | ` `[getAlpha](https://developer.android.com/reference/android/view/animation/Transformation#getAlpha())`() `                                                                                                                                                                                                                                                                      |
| ` `[Matrix](https://developer.android.com/reference/android/graphics/Matrix) | ` `[getMatrix](https://developer.android.com/reference/android/view/animation/Transformation#getMatrix())`() `                                                                                                                                                                                                                                                                    |
| ` int`                                                                       | ` `[getTransformationType](https://developer.android.com/reference/android/view/animation/Transformation#getTransformationType())`() ` Indicates the nature of this transformation.                                                                                                                                                                                               |
| ` void`                                                                      | ` `[set](https://developer.android.com/reference/android/view/animation/Transformation#set(android.view.animation.Transformation))`(`[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` t) ` Clones the specified transformation.                                                                                                   |
| ` void`                                                                      | ` `[setAlpha](https://developer.android.com/reference/android/view/animation/Transformation#setAlpha(float))`(float alpha) ` Sets the degree of transparency                                                                                                                                                                                                                      |
| ` void`                                                                      | ` `[setTransformationType](https://developer.android.com/reference/android/view/animation/Transformation#setTransformationType(int))`(int transformationType) ` Sets the transformation type.                                                                                                                                                                                     |
| ` `[String](https://developer.android.com/reference/java/lang/String)        | ` `[toShortString](https://developer.android.com/reference/android/view/animation/Transformation#toShortString())`() ` Return a string representation of the transformation in a compact form.                                                                                                                                                                                    |
| ` `[String](https://developer.android.com/reference/java/lang/String)        | ` `[toString](https://developer.android.com/reference/android/view/animation/Transformation#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                       |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### TYPE_ALPHA

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TYPE_ALPHA
```

Indicates a transformation that applies an alpha only (uses an identity matrix.)

<br />

Constant Value: 1 (0x00000001)  

### TYPE_BOTH

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TYPE_BOTH
```

Indicates a transformation that applies an alpha and a matrix.

<br />

Constant Value: 3 (0x00000003)  

### TYPE_IDENTITY

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TYPE_IDENTITY
```

Indicates a transformation that has no effect (alpha = 1 and identity matrix.)

<br />

Constant Value: 0 (0x00000000)  

### TYPE_MATRIX

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int TYPE_MATRIX
```

Indicates a transformation that applies a matrix only (alpha = 1.)

<br />

Constant Value: 2 (0x00000002)

## Fields

### mAlpha

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected float mAlpha
```

<br />

<br />

### mMatrix

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected Matrix mMatrix
```

<br />

<br />

### mTransformationType

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected int mTransformationType
```

<br />

<br />

## Public constructors

### Transformation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Transformation ()
```

Creates a new transformation with alpha = 1 and the identity matrix.

<br />

## Public methods

### clear

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void clear ()
```

Reset the transformation to a state that leaves the object being animated in an unmodified state. The transformation type is[TYPE_BOTH](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_BOTH)by default.

<br />

### compose

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void compose (Transformation t)
```

Apply this Transformation to an existing Transformation, e.g. apply a scale effect to something that has already been rotated.

<br />

### getAlpha

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public float getAlpha ()
```

<br />

<br />

|                  Returns                   ||
|---------|-----------------------------------|
| `float` | The degree of transparency <br /> |

### getMatrix

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Matrix getMatrix ()
```

<br />

<br />

|                                                                                          Returns                                                                                          ||
|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| [Matrix](https://developer.android.com/reference/android/graphics/Matrix) | The 3x3 Matrix representing the transformation to apply to the coordinates of the object being animated <br /> |

### getTransformationType

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getTransformationType ()
```

Indicates the nature of this transformation.

<br />

|                                                                                                                                                                                                                      Returns                                                                                                                                                                                                                      ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [TYPE_ALPHA](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_ALPHA),[TYPE_MATRIX](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_MATRIX),[TYPE_BOTH](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_BOTH)or[TYPE_IDENTITY](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_IDENTITY). <br /> |

### set

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void set (Transformation t)
```

Clones the specified transformation.

<br />

|                         Parameters                         ||
|-----|-------------------------------------------------------|
| `t` | `Transformation`: The transformation to clone. <br /> |

### setAlpha

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setAlpha (float alpha)
```

Sets the degree of transparency

<br />

|                                                        Parameters                                                        ||
|---------|-----------------------------------------------------------------------------------------------------------------|
| `alpha` | `float`: 1.0 means fully opaque and 0.0 means fully transparent Value is between 0.0f and 1.0f inclusive <br /> |

### setTransformationType

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setTransformationType (int transformationType)
```

Sets the transformation type.

<br />

|                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                   ||
|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `transformationType` | `int`: One of[TYPE_ALPHA](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_ALPHA),[TYPE_MATRIX](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_MATRIX),[TYPE_BOTH](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_BOTH)or[TYPE_IDENTITY](https://developer.android.com/reference/android/view/animation/Transformation#TYPE_IDENTITY). <br /> |

### toShortString

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toShortString ()
```

Return a string representation of the transformation in a compact form.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### toString

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns a string representation of the object.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |