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 a function to get the target frame rate #5762

Closed
1 of 17 tasks
tapioca24 opened this issue Aug 12, 2022 · 4 comments · Fixed by #5839
Closed
1 of 17 tasks

Add a function to get the target frame rate #5762

tapioca24 opened this issue Aug 12, 2022 · 4 comments · Fixed by #5839

Comments

@tapioca24
Copy link

Increasing Access

I am developing a library for recording p5.js animations and this proposal is to improve it.
Many already use this library, and improving its usability should increase the number of sketches posted to Twitter, Instagram, etc., and thus more access to p5.js.

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

Feature request details

I am developing a library to record p5.js animations.
In a recording library, it makes sense in many use cases to match the recording frame rate to the target frame rate in p5.js.

But it looks like the only way to get the target frame rate is to reference a variable called _targetFrameRate. And this is probably a private variable, not intended for user use. Libraries that depend on private variables in p5.js could suddenly stop working if p5.js is updated, which should be avoided if possible.

It would be great if p5.js supported a function to get the target frame rate as a public API, such as getTargetFrameRate().

@welcome
Copy link

welcome bot commented Aug 12, 2022

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

@limzykenneth
Copy link
Member

Hi @tapioca24, does the return value of frameRate() (without any arguments) not work in your use case?

@tapioca24
Copy link
Author

tapioca24 commented Aug 14, 2022

Hi @limzykenneth, frameRate() does not work in my use case.
frameRate() returns an actual measured value, which is different from the target set by the user. This difference is especially noticeable when there is slow processing in the draw function. I need the target frame rate.

@4slk4
Copy link

4slk4 commented Oct 18, 2022

My team is working on this issue

limzykenneth added a commit that referenced this issue Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants