With Framer Motion's useTransform
, I'm looking to adjust the width of an element using a MotionValue
that is a percentage (e.g. 75%
) rather than in pixels.
The default setting assumes pixels:
<motion.div className="dynamic-element" style={{ width: w }}>
What I'm aiming for is something like this:
<motion.div className="dynamic-element" style={{ width:`${w}%` }}>
Unfortunately, this approach doesn't work.
Is there a way to specify that my MotionValue
should be percentage-based instead of pixel-based?
On a different note, I could use filter: scale()
but this tends to make the content appear blurry (even after trying various solutions without success).