---
title: "AnimationScope"
description: "[AnimationScope] provides all the animation related info specific to an animation run. An
[AnimationScope] will be accessible during an animation."
type: "class"
---

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


<a id='references'></a>

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


```kotlin
public class AnimationScope<T, V : AnimationVector>
internal constructor(
    initialValue: T,
    /** [TwoWayConverter] to convert type [T] from and to [AnimationVector]. */
    public val typeConverter: TwoWayConverter<T, V>,
    initialVelocityVector: V,
    lastFrameTimeNanos: Long,
    /** Target value of the animation. */
    public val targetValue: T,
    /** Start time of the animation in the [System.nanoTime] timebase. */
    @get:Suppress("MethodNameUnits") public val startTimeNanos: Long,
    isRunning: Boolean,
    private val onCancel: () -> Unit,
)
```


`AnimationScope` provides all the animation related info specific to an animation run. An
`AnimationScope` will be accessible during an animation.


## Functions

```kotlin
public fun cancelAnimation()
```


Cancels the animation that this `AnimationScope` corresponds to. The scope will not be
updated any more after `cancelAnimation` is called.


```kotlin
public fun toAnimationState(): AnimationState<T, V>
```


Creates an `AnimationState` that populates all the fields in `AnimationState` from
`AnimationScope`.



