Skip to content

useSpring 0.1.0 view source

function useSpring<T>(
  scope: Fusion.Scope,
  goal: Fusion.UsedAs<T & Ripple.MotionGoal>,
  options: Ripple.SpringOptions?
): Fusion.StateObject<T>

Applies spring animations to the given value, and updates the goal with the latest value on every re-render. Returns a state object with the motor's value. Not to be confused with Fusion's own Spring objects.


Parameters

scope : Fusion.Scope

The scope to store cleanup tasks.

goal : Fusion.UsedAs<T & Ripple.MotionGoal>

The goal of the motor.

options : Ripple.SpringOptions?

Options for the spring.


Returns -> Fusion.StateObject<T>

A state object with the motor's value.


Example Usage

-- TODO: write example