Skip to content

Commit

Permalink
docs: fix impulse example
Browse files Browse the repository at this point in the history
  • Loading branch information
littensy committed Jun 19, 2023
1 parent fb6000f commit 70e28c5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/use-motor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,16 @@ function Bounce() {
const [offset, setOffset, api] = useMotor({ x: 0, y: 0 });

const bounce = () => {
setOffset({
x: new Spring(0, { dampingRatio: 0.4 }),
y: new Spring(0, { dampingRatio: 0.4 }),
});
api.impulse({
x: math.random(-50, 50),
y: math.random(-50, 50),
});
};

useMountEffect(() => {
setOffset({
x: new Spring(0, { dampingRatio: 0.4 }),
y: new Spring(0, { dampingRatio: 0.4 }),
});
});

return (
<textbutton
Event={{
Expand Down

0 comments on commit 70e28c5

Please sign in to comment.