Open snagy opened 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/svelte/svelte-cubed/A7AP65S1fgv3eMJ3TB4QHkjYdiGA
✅ Preview: https://svelte-cubed-git-fork-snagy-main-svelte.vercel.app
oh hell yeah! this is one of those things I was thinking about too.
One of the first things I noticed was "oh! canvas resizing is already done for you. win." and later on down the track, I was like "what about animation/timing/framerates"
Good stuff 👍
edit: omgosh that cube is so cool
This change adds a frame time and delta time to the onFrame callback, to encourage framerate-independent animation.
It just passes through the time counter received from requestAnimationFrame. It's possible we'd want to switch this to the three.js Clock, but that raises complexity to properly create a single clock and update all the frame listeners properly.
I also added an example that uses these values to animate a camera and cube.