Skip to content

Tween

Bindings for @solid-primitives/tween.

Easing

type Easing = float -> float

createTween

let createTween(
    target: Accessor<'T>,
    ?duration: int,
    ?easing: Easing
    ): Accessor<'T>

A derived signal that moves smoothly from the target's previous value to its new one whenever it changes. The target can be any accessor; to tween a component prop, pass fun () -> props.value.

ParamDesc
targetThe reactive value to follow.
durationHow many milliseconds the transition from one value to the next takes. Defaults to 100.
easingA function that maps a number between 0. and 1., to speed up or slow down parts of the transition. Defaults to linear.

Updates run on requestAnimationFrame, and stop once the value reaches the target.

Easings

The binding ships a set of easing functions written in F#, with no dependencies:

InOutIn and out
easeInSineeaseOutSineeaseInOutSine
easeInQuadeaseOutQuadeaseInOutQuad
easeInCubiceaseOutCubiceaseInOutCubic
easeInQuarteaseOutQuarteaseInOutQuart
easeInQuinteaseOutQuinteaseInOutQuint
easeInExpoeaseOutExpoeaseInOutExpo
easeInCirceaseOutCirceaseInOutCirc
easeInBackeaseOutBackeaseInOutBack
easeInElasticeaseOutElasticeaseInOutElastic
easeInBounceeaseOutBounceeaseInOutBounce
Edit this page