# VectorizedFloatAnimationSpec

Artifact: [androidx.compose.animation:animation-core](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/core/VectorizedAnimationSpec.kt+class:androidx.compose.animation.core.VectorizedFloatAnimationSpec) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0) Common/All
- Cmn

  ```
  class VectorizedFloatAnimationSpec<V : AnimationVector> : VectorizedFiniteAnimationSpec<V>
  ```

*** ** * ** ***

A convenient implementation of `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec` that turns a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec` into a multi-dimensional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec`, by using the same `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec` on each dimension of the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` that is being animated.

## Summary

| ### Public constructors |
|---|---|
| `<V : https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec#VectorizedFloatAnimationSpec(androidx.compose.animation.core.FloatAnimationSpec)( anim: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` from a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec`. | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec#getDurationNanos(androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)(initialValue: V, targetValue: V, initialVelocity: V)` Calculates the duration of an animation. | Cmn |
| `open V` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec#getEndVelocity(androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)(initialValue: V, targetValue: V, initialVelocity: V)` Calculates the end velocity of the animation with the provided start/end values, and start velocity. | Cmn |
| `open V` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec#getValueFromNanos(kotlin.Long,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)( playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, initialValue: V, targetValue: V, initialVelocity: V )` Calculates the value of the animation at given the playtime, with the provided start/end values, and start velocity. | Cmn |
| `open V` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFloatAnimationSpec#getVelocityFromNanos(kotlin.Long,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)( playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, initialValue: V, targetValue: V, initialVelocity: V )` Calculates the velocity of the animation at given the playtime, with the provided start/end values, and start velocity. | Cmn |

### Inherited properties

From [androidx.compose.animation.core.VectorizedFiniteAnimationSpec](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFiniteAnimationSpec) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedFiniteAnimationSpec#isInfinite()`

Whether or not the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` specifies an infinite animation.
Cmn

## Public constructors

### VectorizedFloatAnimationSpec

Cmn

```
<V : AnimationVector> VectorizedFloatAnimationSpec(
    anim: FloatAnimationSpec
)
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec` from a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec`. The given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec` will be used to animate every dimension of the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector`.

| Parameters |
|---|---|
| `anim: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatAnimationSpec` | the animation spec for animating each dimension of the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` |

## Public functions

### getDurationNanos

Cmn

```
open fun getDurationNanos(initialValue: V, targetValue: V, initialVelocity: V): Long
```

Calculates the duration of an animation. For duration-based animations, this will return the pre-defined duration. For physics-based animations, the duration will be estimated based on the physics configuration (such as spring stiffness, damping ratio, visibility threshold) as well as the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec#getDurationNanos(androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)`, `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec#getDurationNanos(androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)` values, and `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec#getDurationNanos(androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector,androidx.compose.animation.core.AnimationVector)`.

| Parameters |
|---|---|
| `initialValue: V` | start value of the animation |
| `targetValue: V` | end value of the animation |
| `initialVelocity: V` | start velocity of the animation |

### getEndVelocity

Cmn

```
open fun getEndVelocity(initialValue: V, targetValue: V, initialVelocity: V): V
```

Calculates the end velocity of the animation with the provided start/end values, and start velocity. For duration-based animations, end velocity will be the velocity of the animation at the duration time. This is also the default assumption. However, for physics-based animations, end velocity is an `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` of 0s.

| Parameters |
|---|---|
| `initialValue: V` | start value of the animation |
| `targetValue: V` | end value of the animation |
| `initialVelocity: V` | start velocity of the animation |

### getValueFromNanos

Cmn

```
open fun getValueFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
): V
```

Calculates the value of the animation at given the playtime, with the provided start/end values, and start velocity.

| Parameters |
|---|---|
| `playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | time since the start of the animation |
| `initialValue: V` | start value of the animation |
| `targetValue: V` | end value of the animation |
| `initialVelocity: V` | start velocity of the animation |

### getVelocityFromNanos

Cmn

```
open fun getVelocityFromNanos(
    playTimeNanos: Long,
    initialValue: V,
    targetValue: V,
    initialVelocity: V
): V
```

Calculates the velocity of the animation at given the playtime, with the provided start/end values, and start velocity.

| Parameters |
|---|---|
| `playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | time since the start of the animation |
| `initialValue: V` | start value of the animation |
| `targetValue: V` | end value of the animation |
| `initialVelocity: V` | start velocity of the animation |