Open ali-idrizi opened 1 year ago
I concur.
I have the following transform:
const { scrollYProgress } = useScroll({
target: containerRef,
offset: ["start end", "end end"],
});
const progress = useTransform(scrollYProgress, [0, 0.3, 0.7], [0, 0, 1]);
const vidScale = useTransform(
progress,
[0, 1],
[1, 9],
);
// even though progress will be 1, vidScale won't reach it's target.
progress.on("change", (v) => { console.log(v, vidScale.get() });
Even though progress
reaches 1
, headingScale
is shy of it's needed target (9
in this example).
I am building a complicated animation, where a transform depends on several motion values. These values are sometimes repeating, so I extracted them to separate motion values, which are calculated using
useTransform
. I have managed to reproduce the issue with a very simple example:Here is a Codesandbox of the same: https://codesandbox.io/s/framer-motion-enter-animation-forked-4jfkdc?file=/src/App.tsx
If you check the logs you will notice:
As you can see, the
useTransform
forresult
never logs theaQuarter
value of25
, while the same is being reported byuseMotionValueEvent
. This issue results in the transform outputting an incorrect value forresult
of100
, while it is supposed to be125
.