diff --git a/src/hooks/useAnimationLoop/useAnimationLoop.stories.tsx b/src/hooks/useAnimationLoop/useAnimationLoop.stories.tsx index 06a2770..2c6fdd8 100644 --- a/src/hooks/useAnimationLoop/useAnimationLoop.stories.tsx +++ b/src/hooks/useAnimationLoop/useAnimationLoop.stories.tsx @@ -9,16 +9,13 @@ export default { }; function DemoComponent(): ReactElement { + const [timestamp, setTimestamp] = useState(0); const [delta, setDelta] = useState(0); - const [currentTimestamp, setCurrentTimestamp] = useState(0); - const [isRunning, toggleIsRunning] = useToggle(true); - useAnimationLoop(() => { - const timestamp = Date.now(); - - setDelta(timestamp - currentTimestamp); - setCurrentTimestamp(timestamp); + useAnimationLoop((_timestamp: DOMHighResTimeStamp) => { + setDelta(_timestamp - timestamp); + setTimestamp(_timestamp); }, isRunning); return ( @@ -30,7 +27,7 @@ function DemoComponent(): ReactElement {
Test Area
-

Current time: {currentTimestamp}

+

Timestamp: {timestamp}

Delta: {delta}