Skip to content

API Reference / @gtkx/animated / SpringValue

Class: SpringValue<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:333

Only numbers, strings, and arrays of numbers/strings are supported. Non-animatable strings are also supported.

Extends

Type Parameters

T

T = any

Constructors

Constructor

new SpringValue<T>(from, props?): SpringValue<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:351

Parameters

from

Exclude<T, object>

props?

SpringUpdate<T>

Returns

SpringValue<T>

Overrides

FrameValue.constructor

Constructor

new SpringValue<T>(props?): SpringValue<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:352

Parameters

props?

SpringUpdate<T>

Returns

SpringValue<T>

Overrides

FrameValue<T>.constructor

Properties

_lastCallId

protected _lastCallId: number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:347

The counter for tracking scheduleProps calls


_lastToId

protected _lastToId: number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:349

The last scheduleProps call that changed the to prop


_memoizedDuration

protected _memoizedDuration: number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:350


_pendingCalls

protected _pendingCalls: Set<AnimationResolver<SpringValue<T>>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:345

The promise resolvers of pending start calls


_priority

protected _priority: number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:50

Inherited from

FrameValue._priority


_state

protected _state: RunAsyncState<SpringValue<T>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:343

The state for runAsync calls


animation

animation: Animation<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:337

The animation state


defaultProps

defaultProps: DefaultSpringProps<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:341

Some props have customizable default values


id

readonly id: number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:47

Inherited from

FrameValue.id


key?

optional key?: string

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:335

The property name used when to or from is an object. Useful when debugging too.

Overrides

FrameValue.key


queue?

optional queue?: SpringUpdate<T>[]

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:339

The queue of pending props

Accessors

goal

Get Signature

get goal(): T

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:355

Returns

T


hasAnimated

Get Signature

get hasAnimated(): boolean

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:360

When true, this value has been animated at least once.

Returns

boolean


idle

Get Signature

get idle(): boolean

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:354

Equals true when not advancing on each frame.

Returns

boolean

Overrides

FrameValue.idle


isAnimating

Get Signature

get isAnimating(): boolean

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:365

When true, this value has an unfinished animation, which is either active or paused.

Returns

boolean


isDelayed

Get Signature

get isDelayed(): boolean | undefined

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:374

Returns

boolean | undefined


isPaused

Get Signature

get isPaused(): boolean

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:369

When true, all current and future animations are paused.

Returns

boolean


priority

Get Signature

get priority(): number

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:51

Returns

number

Set Signature

set priority(priority): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:52

Parameters
priority

number

Returns

void

Inherited from

FrameValue.priority


velocity

Get Signature

get velocity(): VelocityProp<T>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:356

Returns

VelocityProp<T>

Methods

_attach()

protected _attach(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:433

Called when the first child is added.

Returns

void

Overrides

FrameValue._attach


_detach()

protected _detach(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:434

Called when the last child is removed.

Returns

void

Overrides

FrameValue._detach


_focus()

protected _focus(value): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:432

Update the animation.to value, which might be a FluidValue

Parameters

value

T | FluidValue<T, any>

Returns

void


_merge()

protected _merge(range, props, resolve): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:430

Merge props into the current animation

Parameters

range

AnimationRange<T>

props

RunAsyncProps<SpringValue<T>>

resolve

AnimationResolver<SpringValue<T>>

Returns

void


_onChange()

protected _onChange(value, idle?): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:441

Tell our children about our new value

Parameters

value

T

idle?

boolean

Returns

void

Overrides

FrameValue._onChange


_onPriorityChange()

protected _onPriorityChange(priority): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:73

Tell our children about our new priority

Parameters

priority

number

Returns

void

Inherited from

FrameValue._onPriorityChange


_onStart()

protected _onStart(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:440

Returns

void


_prepareNode()

protected _prepareNode(props): object

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:416

Parse the to and from range from the given props object.

This also ensures the initial value is available to animated components during the render phase.

Parameters

props
default?

any

from?

any

reverse?

boolean

to?

any

Returns

object

from

from: any

to

to: any


_resume()

protected _resume(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:443

Returns

void


_set()

protected _set(arg, idle?): Animated<any> | undefined

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:439

Update the current value from outside the frameloop, and return the Animated node.

Parameters

arg

T | FluidValue<T, any>

idle?

boolean

Returns

Animated<any> | undefined


_start()

protected _start(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:442

Returns

void


_stop()

protected _stop(goal?, cancel?): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:449

Exit the frameloop and notify onRest listeners.

Always wrap _stop calls with batchedUpdates.

Parameters

goal?

any

cancel?

boolean

Returns

void


_update()

protected _update(__namedParameters, isLoop?): AsyncResult<SpringValue<T>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:426

Every update is processed by this method before merging.

Parameters

__namedParameters

SpringProps<T>

isLoop?

boolean

Returns

AsyncResult<SpringValue<T>>


advance()

advance(dt): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:376

Advance the current animation by a number of milliseconds

Parameters

dt

number

Returns

void

Overrides

FrameValue.advance


eventObserved()

eventObserved(event): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:409

Internal

Parameters

event

Event

Returns

void

Overrides

FrameValue.eventObserved


finish()

finish(): this

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:387

Skip to the end of the current animation.

Returns

this


get()

get(): T

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:54

Get the current value

Returns

T

Inherited from

FrameValue.get


interpolate()

interpolate<Out>(...args): Interpolation<T, Out>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:58

Type Parameters

Out

Out

Parameters

args

...InterpolatorArgs<T, Out>

Returns

Interpolation<T, Out>

Deprecated

Use the to method instead.

Inherited from

FrameValue.interpolate


observerAdded()

protected observerAdded(count): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:60

Called after an observer is added.

Parameters

count

number

Returns

void

Inherited from

FrameValue.observerAdded


observerRemoved()

protected observerRemoved(count): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:61

Called after an observer is removed.

Parameters

count

number

Returns

void

Inherited from

FrameValue.observerRemoved


pause()

pause(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:383

Freeze the active animation in time, as well as any updates merged before resume is called.

Returns

void


reset()

reset(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:407

Restart the animation.

Returns

void


resume()

resume(): void

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:385

Resume the animation if paused.

Returns

void


set()

set(value): this

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:378

Set the current value, while stopping the current animation

Parameters

value

T | FluidValue<T, any>

Returns

this


start()

Call Signature

start(): AsyncResult<SpringValue<T>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:397

Update this value's animation using the queue of pending props, and unpause the current animation (if one is frozen).

When arguments are passed, a new animation is created, and the queued animations are left alone.

Returns

AsyncResult<SpringValue<T>>

Call Signature

start(props): AsyncResult<SpringValue<T>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:398

Update this value's animation using the queue of pending props, and unpause the current animation (if one is frozen).

When arguments are passed, a new animation is created, and the queued animations are left alone.

Parameters
props

SpringUpdate<T>

Returns

AsyncResult<SpringValue<T>>

Call Signature

start(to, props?): AsyncResult<SpringValue<T>>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:399

Update this value's animation using the queue of pending props, and unpause the current animation (if one is frozen).

When arguments are passed, a new animation is created, and the queued animations are left alone.

Parameters
to

T

props?

SpringProps<T>

Returns

AsyncResult<SpringValue<T>>


stop()

stop(cancel?): this

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:405

Stop the current animation, and cancel any delayed updates.

Pass true to call onRest with cancelled: true.

Parameters

cancel?

boolean

Returns

this


to()

to<Out>(...args): Interpolation<T, Out>

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:56

Create a spring that maps our value to another value

Type Parameters

Out

Out

Parameters

args

...InterpolatorArgs<T, Out>

Returns

Interpolation<T, Out>

Inherited from

FrameValue.to


toJSON()

toJSON(): T

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:59

Returns

T

Inherited from

FrameValue.toJSON


update()

update(props): this

Defined in: node_modules/.pnpm/@react-spring+core@10.1.2_react@19.2.8/node_modules/@react-spring/core/dist/react-spring_core.modern.d.mts:389

Push props into the pending queue.

Parameters

props

SpringUpdate<T>

Returns

this

Released under the MPL-2.0 License.