---
title: "copy"
description: "Creates a new [AnimationState] from a given [AnimationState]. This function allows some of the
fields to be different in the new [AnimationState]."
type: "function"
---

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


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


```kotlin
public fun <T, V : AnimationVector> AnimationState<T, V>.copy(
    value: T = this.value,
    velocityVector: V? = this.velocityVector.copy(),
    lastFrameTimeNanos: Long = this.lastFrameTimeNanos,
    finishedTimeNanos: Long = this.finishedTimeNanos,
    isRunning: Boolean = this.isRunning,
): AnimationState<T, V>
```


Creates a new `AnimationState` from a given `AnimationState`. This function allows some of the
fields to be different in the new `AnimationState`.

#### Parameters

| | |
| --- | --- |
| value | value of the `AnimationState`, using the value of the given `AnimationState` by default |
| velocityVector | velocity of the `AnimationState`, using the velocity of the given `AnimationState` by default. |
| lastFrameTimeNanos | last frame time of the animation, same as the given `AnimationState` by default |
| finishedTimeNanos | the time that the animation finished successfully, `AnimationConstants.UnspecifiedTime` until then. Default value is the same as the given `AnimationState`. |
| isRunning | whether the `AnimationState` is currently being updated by an animation. Same as the given `AnimationState` by default |


#### Returns

| | |
| --- | --- |
|  | A new `AnimationState` instance copied from the given instance, with some fields optionally altered |




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


```kotlin
public fun AnimationState<Float, AnimationVector1D>.copy(
    value: Float = this.value,
    velocity: Float = this.velocityVector.value,
    lastFrameTimeNanos: Long = this.lastFrameTimeNanos,
    finishedTimeNanos: Long = this.finishedTimeNanos,
    isRunning: Boolean = this.isRunning,
): AnimationState<Float, AnimationVector1D>
```


Creates a new `AnimationState` of Float `value` type from a given `AnimationState` of the same
type. This function allows some of the fields to be different in the new `AnimationState`.

#### Parameters

| | |
| --- | --- |
| value | value of the `AnimationState`, using the value of the given `AnimationState` by default |
| velocity | velocity of the `AnimationState`, using the velocity of the given `AnimationState` by default. |
| lastFrameTimeNanos | last frame time of the animation, same as the given `AnimationState` by default |
| finishedTimeNanos | the time that the animation finished successfully, same as the given `AnimationState` by default. |
| isRunning | whether the `AnimationState` is currently being updated by an animation. Same as the given `AnimationState` by default |


#### Returns

| | |
| --- | --- |
|  | A new `AnimationState` instance copied from the given instance, with some fields optionally altered |




