vael-ui v0.5.7

Motion

springEasing

Turns a spring into a CSS linear() curve and its settle time. Use it to give element.animate() or a CSS transition the same spring as vael-ui.

Turns a spring into a CSS linear() curve and the time it takes to settle, in ms. It's the curve vael-ui uses for ConfigProvider's :motion="{ spring }". The result has the same shape as the options element.animate() takes, so your own animations can move on the same spring without a library. Damping below 1 overshoots.

Install

import { springEasing } from 'vael-ui/motion'

Examples

Parameters

NameTypeDescription
spring{ damping?: number; response?: number }The spring to convert. Damping 1 settles without overshoot; below 1 it overshoots. response is roughly the time to arrive, in seconds.

Returns

NameTypeDescription
easingstringThe CSS linear() easing that follows the spring.
durationnumberHow long the spring takes to settle, in ms.