Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/view/WindowInsetsAnimation#nestedclasses) \| [Ctors](https://developer.android.com/reference/android/view/WindowInsetsAnimation#pubctors) \| [Methods](https://developer.android.com/reference/android/view/WindowInsetsAnimation#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/WindowInsetsAnimation#inhmethods)

# WindowInsetsAnimation

*** ** * ** ***

` public final class WindowInsetsAnimation `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Class representing an animation of a set of windows that cause insets.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/view/WindowInsetsAnimation.Bounds` Class representing the range of an `https://developer.android.com/reference/android/view/WindowInsetsAnimation` |
| ` class` | `https://developer.android.com/reference/android/view/WindowInsetsAnimation.Callback` Interface that allows the application to listen to animation events for windows that cause insets. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#WindowInsetsAnimation(int,%20android.view.animation.Interpolator,%20long)(int typeMask, https://developer.android.com/reference/android/view/animation/Interpolator interpolator, long durationMillis) ` Creates a new `https://developer.android.com/reference/android/view/WindowInsetsAnimation` object. |

| ### Public methods ||
|---|---|
| ` float` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getAlpha()() ` Retrieves the translucency of the windows that are animating. |
| ` long` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getDurationMillis()() ` |
| ` float` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getFraction()() ` Returns the raw fractional progress of this animation between start state of the animation and the end state of the animation. |
| ` float` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getInterpolatedFraction()() ` Returns the interpolated fractional progress of this animation between start state of the animation and the end state of the animation. |
| ` https://developer.android.com/reference/android/view/animation/Interpolator` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getInterpolator()() ` Retrieves the interpolator used for this animation, or `null` if this animation doesn't follow an interpolation curved. |
| ` int` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#getTypeMask()() ` |
| ` void` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#setAlpha(float)(float alpha) ` Sets the translucency of the windows that are animating. |
| ` void` | ` https://developer.android.com/reference/android/view/WindowInsetsAnimation#setFraction(float)(float fraction) ` Set fraction of the progress if `https://developer.android.com/reference/android/view/WindowInsets.Type` animation is controlled by the app. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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*.

## Public constructors

### WindowInsetsAnimation

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

```
public WindowInsetsAnimation (int typeMask, 
                Interpolator interpolator, 
                long durationMillis)
```

Creates a new `https://developer.android.com/reference/android/view/WindowInsetsAnimation` object.

This should only be used for testing, as usually the system creates this object for the application to listen to with `https://developer.android.com/reference/android/view/WindowInsetsAnimation.Callback`.

<br />

<br />

| Parameters ||
|---|---|
| `typeMask` | `int`: The bitmask of `https://developer.android.com/reference/android/view/WindowInsets.Type`s that are animating. Value is either `0` or a combination of the following: |
| `interpolator` | `Interpolator`: The interpolator of the animation. This value may be `null`. <br /> |
| `durationMillis` | `long`: The duration of the animation in `https://developer.android.com/reference/java/util/concurrent/TimeUnit#MILLISECONDS`. <br /> |

## Public methods

### getAlpha

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

```
public float getAlpha ()
```

Retrieves the translucency of the windows that are animating.

<br />

| Returns ||
|---|---|
| `float` | Alpha of windows that cause insets of type `https://developer.android.com/reference/android/view/WindowInsets.Type`. Value is between 0.0f and 1.0f inclusive <br /> |

### getDurationMillis

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

```
public long getDurationMillis ()
```

<br />

<br />

| Returns ||
|---|---|
| `long` | duration of animation in `https://developer.android.com/reference/java/util/concurrent/TimeUnit#MILLISECONDS`, or -1 if the animation doesn't have a fixed duration. <br /> |

### getFraction

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

```
public float getFraction ()
```

Returns the raw fractional progress of this animation between start state of the animation and the end state of the animation. Note that this progress is the global progress of the animation, whereas `https://developer.android.com/reference/android/view/WindowInsetsAnimation.Callback#onProgress(android.view.WindowInsets,%20java.util.List<android.view.WindowInsetsAnimation>)` will only dispatch the insets that may be inset with `https://developer.android.com/reference/android/view/WindowInsets#inset(android.graphics.Insets)` by parents of views in the hierarchy. Progress per insets animation is global for the entire animation. One animation animates all things together (in, out, ...). If they don't animate together, we'd have multiple animations.

Note: In case the application is controlling the animation, the valued returned here will be the same as the application passed into `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#setInsetsAndAlpha(android.graphics.Insets,%20float,%20float)`.

<br />

<br />

| Returns ||
|---|---|
| `float` | The current progress of this animation. Value is between 0.0f and 1.0f inclusive <br /> |

### getInterpolatedFraction

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

```
public float getInterpolatedFraction ()
```

Returns the interpolated fractional progress of this animation between start state of the animation and the end state of the animation. Note that this progress is the global progress of the animation, whereas `https://developer.android.com/reference/android/view/WindowInsetsAnimation.Callback#onProgress(android.view.WindowInsets,%20java.util.List<android.view.WindowInsetsAnimation>)` will only dispatch the insets that may be inset with `https://developer.android.com/reference/android/view/WindowInsets#inset(android.graphics.Insets)` by parents of views in the hierarchy. Progress per insets animation is global for the entire animation. One animation animates all things together (in, out, ...). If they don't animate together, we'd have multiple animations.

Note: In case the application is controlling the animation, the valued returned here will be the same as the application passed into `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#setInsetsAndAlpha(android.graphics.Insets,%20float,%20float)`, interpolated with the interpolator passed into `https://developer.android.com/reference/android/view/WindowInsetsController#controlWindowInsetsAnimation(int,%20long,%20android.view.animation.Interpolator,%20android.os.CancellationSignal,%20android.view.WindowInsetsAnimationControlListener)`.

Note: For system-initiated animations, this will always return a valid value between 0 and 1.

<br />

<br />

| Returns ||
|---|---|
| `float` | The current interpolated progress of this animation. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimation#getFraction()`

### getInterpolator

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

```
public Interpolator getInterpolator ()
```

Retrieves the interpolator used for this animation, or `null` if this animation doesn't follow an interpolation curved. For system-initiated animations, this will never return `null`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/animation/Interpolator` | The interpolator used for this animation. <br /> |

### getTypeMask

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

```
public int getTypeMask ()
```

<br />

<br />

| Returns ||
|---|---|
| `int` | The bitmask of `https://developer.android.com/reference/android/view/WindowInsets.Type`s that are animating. Value is either `0` or a combination of the following: |

### setAlpha

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

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

Sets the translucency of the windows that are animating.

Note: This should only be used for testing, as the system fills in the alpha for the application or the alpha that was passed into `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#setInsetsAndAlpha(android.graphics.Insets,%20float,%20float)` is being used.

<br />

<br />

| Parameters ||
|---|---|
| `alpha` | `float`: Alpha of windows that cause insets of type `https://developer.android.com/reference/android/view/WindowInsets.Type`. Value is between 0.0f and 1.0f inclusive <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimation#getAlpha()`

### setFraction

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

```
public void setFraction (float fraction)
```

Set fraction of the progress if `https://developer.android.com/reference/android/view/WindowInsets.Type` animation is controlled by the app.

Note: This should only be used for testing, as the system fills in the fraction for the application or the fraction that was passed into `https://developer.android.com/reference/android/view/WindowInsetsAnimationController#setInsetsAndAlpha(android.graphics.Insets,%20float,%20float)` is being used.

<br />

<br />

| Parameters ||
|---|---|
| `fraction` | `float`: fractional progress between 0 and 1 where 0 represents hidden and zero progress and 1 represent fully shown final state. Value is between 0.0f and 1.0f inclusive <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/WindowInsetsAnimation#getFraction()`