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

[feature suggestion] Make default frame rate from p5js #14

Open
jcubic opened this issue Aug 11, 2022 · 3 comments
Open

[feature suggestion] Make default frame rate from p5js #14

jcubic opened this issue Aug 11, 2022 · 3 comments

Comments

@jcubic
Copy link

jcubic commented Aug 11, 2022

I'm not sure if this is possible but in my coding playground prototype:

https://p5.javascript.org.pl/amused-loan?template=none

To record a proper Gif I still need to put P5.capture code in my sketch. Capture frame rate should match frame rate from p5.js

If I want to capture the animation I need to copy paste p5.capture default config:

function setup() {
    createCanvas(400, 400);
    //noLoop();
    frameRate(5);
}

P5Capture.setDefaultOptions({
    disableUi: true,
    format: "gif",
    framerate: 5,
    quality: 0.5,
});

To not break the API, how about -1 value will mean that it should take frameRate from P5.js?

@tapioca24
Copy link
Owner

Hi @jcubic, Thank you for your suggestion.

This sounds good. It makes sense to reference the frame rate in p5.js, since generally the animation frame rate and the recording frame rate should match.

My only concern is that the API to get the target frame rate is not exposed by p5.js and must reference a private variable called _targetFrameRate. This means that an update to p5.js could cause it to suddenly stop working.
Please give me some time as I need to do a little research on this.

@jcubic
Copy link
Author

jcubic commented Aug 12, 2022

If P5.js doesn't support the API to allow this, maybe it's worth creating an issue and asking if they are willing to expose the frame rate somehow.

@tapioca24
Copy link
Owner

That would be good. I have already created it.
processing/p5.js#5762

If I can get approval I would like to start working on it.

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

No branches or pull requests

2 participants