mapValue creates a new read-only motion value that maps the output of a numerical motion value to a range of numbers, colors or complex strings.
const x = motionValue(100)
// Fade out outside the 0-100 range
const opacity = mapValue(x, [-100, 0, 100, 200], [0, 1, 1, 0])
// Shift color when fading out
const backgroundColor = mapValue(opacity, [0, 1], ["#f00", "#00f"])Usage
Import mapValue from