useTransform

useTransform creates a new motion value that transforms the output of one or more motion values.

Usage

import { useTransform } from 'motion-v'

useTransform can be used in two ways: with a transform function and via value maps.

// Transform function
useTransform(() => x.get() * 2)

// Value mapping
useTransform(x, [0, 100], ['#f00', '00f'])

Drag transform

Resources