Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timing arguments to the onFrame callback #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

snagy
Copy link

@snagy snagy commented Nov 24, 2021

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.

@vercel
Copy link

vercel bot commented Nov 24, 2021

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

@DefinitelyMaybe
Copy link

DefinitelyMaybe commented Dec 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants