API Reference / @gtkx/animated / Controller
Class: Controller<State>
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:457
Type Parameters
State
Constructors
Constructor
new Controller<
State>(props?,flush?):Controller<State>
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:504
Parameters
props?
ControllerUpdate<State, undefined> | null
flush?
ControllerFlushFn<any>
Returns
Controller<State>
Properties
_active
protected_active:Set<FrameValue<any>>
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:484
The values currently being animated
_changed
protected_changed:Set<FrameValue<any>>
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:486
The values that changed recently
_events
protected_events: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:499
The event queues that are flushed once per frame maximum
onChange
onChange:
Map<OnChange<SpringValue<State>,Controller<State>,any>,AnimationResult<any>>
onRest
onRest:
Map<OnRest<SpringValue<State>,Controller<State>,any>,AnimationResult<any>>
onStart
onStart:
Map<OnStart<SpringValue<State>,Controller<State>,any>,AnimationResult<any>>
_flush?
protectedoptional_flush?:ControllerFlushFn<Controller<State>>
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:469
Custom handler for flushing update queues
_initialProps?
protectedoptional_initialProps?:Lookup<any>
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:471
These props are used by all future spring values
_lastAsyncId
protected_lastAsyncId: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:473
The counter for tracking scheduleProps calls
_lastLoopId
protected_lastLoopId: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:482
Token identifying the in-flight loop chain. Bumped on every top-level flushUpdate so a subsequent loop iteration can detect that a newer external update has superseded it, and exit instead of dispatching another iteration. Without this, a loop: true → loop: false (or any non-loop) update from a re-render would race against the captured loop of the prior chain, which keeps recursing. See issue #1193.
_onLoopReset?
protectedoptional_onLoopReset?:Set<() =>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:497
Listeners notified synchronously each time flushUpdate recurses into the next loop iteration. Used by useTrail to keep chained children phase-aligned with the head controller's loop restarts.
_started
protected_started: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:488
Equals false when onStart listeners can be called
_state
protected_state:RunAsyncState<Controller<State>>
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:491
State used by the runAsync function
id
readonlyid: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:458
queue
queue:
ControllerQueue<State>
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:462
The queue of props passed to the update method.
ref?
optionalref?:SpringRef<State>
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:467
The injected ref. When defined, render-based updates are pushed onto the queue instead of being auto-started.
springs
springs:
SpringValues<State>
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:460
The animated values
Accessors
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:509
Equals true when no spring values are in the frameloop, and no async animation is currently active.
Returns
boolean
item
Get Signature
get item():
any
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:510
Returns
any
Set Signature
set item(
item):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:511
Parameters
item
any
Returns
void
Methods
_onFrame()
protected_onFrame():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:552
Internal
Called at the end of every animation frame
Returns
void
each()
each(
iterator):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:543
Call a function once per spring value
Parameters
iterator
(spring, key) => void
Returns
void
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:554
Internal
Parameters
event
Returns
void
get()
get():
State&UnknownProps
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:513
Get the current values of our springs
Returns
State & UnknownProps
onLoopReset()
onLoopReset(
fn): () =>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:550
Internal
Subscribe to loop iteration restarts on this controller. Returns an unsubscribe function. Listeners fire synchronously inside flushUpdate just before the next iteration is dispatched.
Parameters
fn
() => void
Returns
() => void
pause()
pause(
keys?):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:539
Freeze the active animation in time
Parameters
keys?
OneOrMore<string>
Returns
this
resume()
resume(
keys?):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:541
Resume the animation if paused.
Parameters
keys?
OneOrMore<string>
Returns
this
set()
set(
values):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:515
Set the current values without animating.
Parameters
values
Partial<State>
Returns
void
start()
start(
props?):AsyncResult<Controller<State>>
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:525
Start the queued animations for every spring, and resolve the returned promise once all queued animations have finished or been cancelled.
When you pass a queue (instead of nothing), that queue is used instead of the queued animations added with the update method, which are left alone.
Parameters
props?
OneOrMore<ControllerUpdate<State, undefined>> | null
Returns
AsyncResult<Controller<State>>
stop()
Call Signature
stop():
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:527
Stop all animations.
Returns
this
Call Signature
stop(
keys):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:529
Stop animations for the given keys.
Parameters
keys
OneOrMore<string>
Returns
this
Call Signature
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:531
Cancel all animations.
Parameters
cancel
boolean
Returns
this
Call Signature
stop(
cancel,keys):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:533
Cancel animations for the given keys.
Parameters
cancel
boolean
keys
OneOrMore<string>
Returns
this
Call Signature
stop(
keys?):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:535
Stop some or all animations.
Parameters
keys?
OneOrMore<string>
Returns
this
Call Signature
stop(
cancel,keys?):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:537
Cancel some or all animations.
Parameters
cancel
boolean
keys?
OneOrMore<string>
Returns
this
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:517
Push an update onto the queue of each value.
Parameters
props
ControllerUpdate<State, undefined> | Falsy
Returns
this