Tweening in ripple is unsuccessful

I am attempting to tween a react component representing a card to a specific location however I am having trouble getting the tween to initiate. Can any you point me to what I am doing wrong? code & image are attached:
card2: React.createElement("ImageLabel",
{...
Position: UDim2.fromScale(motion.get().x, motion.get().y), //UDim2.fromScale(0.620123, 0.482931),
...
},
...
),
card2: React.createElement("ImageLabel",
{...
Position: UDim2.fromScale(motion.get().x, motion.get().y), //UDim2.fromScale(0.620123, 0.482931),
...
},
...
),
const motion = createMotion({ x: 0, y: 0 });
useEffect(() => {
motion.tween({ x: 0.620123, y: 0.482931 },
{
time: 2,
},
);
}, []);
const motion = createMotion({ x: 0, y: 0 });
useEffect(() => {
motion.tween({ x: 0.620123, y: 0.482931 },
{
time: 2,
},
);
}, []);
No description
Solution:
for bindings you should use map, for example: binding.map((v) => v * 2)...
Jump to solution
6 Replies
Solution
PepeElToro41
PepeElToro416d ago
for bindings you should use map, for example: binding.map((v) => v * 2)
PepeElToro41
PepeElToro416d ago
thats because bindings will not cause a re-render they bind to a single property
Rennie
RennieOP6d ago
the object returned from createMotion does not return a map function
Rennie
RennieOP6d ago
No description
Rennie
RennieOP6d ago
Unless I'm still misunderstanding My god, i get it now Thank you
const [card1Position, card1PositionMotion] = useMotion({ x: 0, y: 0 });
const [card1Position, card1PositionMotion] = useMotion({ x: 0, y: 0 });
Position: card1Position.map(({ x, y }) => UDim2.fromScale(x, y)), //UDim2.fromScale(0.620123, 0.482931),
Position: card1Position.map(({ x, y }) => UDim2.fromScale(x, y)), //UDim2.fromScale(0.620123, 0.482931),
My confusion came from the function signature of useMotion(0). In typescript you can't overload a function but I guess they found a way to here. Thank you again! you've been a tremendous help
Phantom
Phantom6d ago
you can mark pepe's post as solution btw

Did you find this page helpful?