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

Prevent usage of getElapsedTime #3455

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AlaricBaraou
Copy link
Contributor

@AlaricBaraou AlaricBaraou commented Feb 10, 2025

Following this PR to Drei

The doc currently encourage people to use .getElapsedTime() for animations, while they should never ( as far as I can think of ) call it. If they need the elapsedTime they can read it from .elapsedTime that is updated by the internal call to getDelta.
Otherwise the next delta of the whole app will be affected.

This PR updates the doc and add a warning to each call to getElapsedTime() for the main state clock.

Edit: We could make a second warning for calls to getDelta but I never seen this being used by mistake.

Copy link

codesandbox-ci bot commented Feb 10, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 99ba76d:

Sandbox Source
example Configuration

@AlaricBaraou
Copy link
Contributor Author

AlaricBaraou commented Feb 10, 2025

We could consider moving to Timer instead of using the clock in the main state.

Learned about it while talking about the getElapsedTime issue here
mrdoob/three.js#30497

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.

1 participant