---
title: "AnimationState"
description: "Factory method for creating an [AnimationState] for Float [initialValue]."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
public fun AnimationState(
    initialValue: Float,
    initialVelocity: Float = 0f,
    lastFrameTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    finishedTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    isRunning: Boolean = false,
): AnimationState<Float, AnimationVector1D>
```


Factory method for creating an `AnimationState` for Float `initialValue`.

#### Parameters

| | |
| --- | --- |
| initialValue | initial value of the `AnimationState` |
| initialVelocity | initial velocity of the `AnimationState`, 0 (i.e. no velocity) by default |
| lastFrameTimeNanos | last frame time of the animation, `AnimationConstants.UnspecifiedTime` by default |
| finishedTimeNanos | the time that the animation finished successfully, `AnimationConstants.UnspecifiedTime` by default. |
| isRunning | whether the `AnimationState` is currently being updated by an animation. False by default |


#### Returns

| | |
| --- | --- |
|  | A new `AnimationState` instance |




<div class='sourceset sourceset-common'>Common</div>


```kotlin
public fun <T, V : AnimationVector> AnimationState(
    typeConverter: TwoWayConverter<T, V>,
    initialValue: T,
    initialVelocity: T,
    lastFrameTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    finishedTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    isRunning: Boolean = false,
): AnimationState<T, V>
```


Factory method for creating an `AnimationState` with an `initialValue` and an `initialVelocity`.

#### Parameters

| | |
| --- | --- |
| typeConverter | `TwoWayConverter` to convert type `T` from and to `AnimationVector` |
| initialValue | initial value of the `AnimationState` |
| initialVelocity | initial velocity of the `AnimationState` |
| lastFrameTimeNanos | last frame time of the animation, `AnimationConstants.UnspecifiedTime` by default |
| finishedTimeNanos | the time that the animation finished successfully, `AnimationConstants.UnspecifiedTime` by default. |
| isRunning | whether the `AnimationState` is currently being updated by an animation. False by default |


#### Returns

| | |
| --- | --- |
|  | A new `AnimationState` instance |




