In Paper.js, is it possible to change the frame rate of the onFrame(event)
function? The paper.js website tutorial says the function is by default called 60 times per second, but it does not include if it is possible (and how) to change the frame rate of this function.
Change frame rate in paper.js
Asked Answered
No, but you can easily skip frames in the code within your onFrame
function.
Example:
The following code emulates a 30 fps frame rate by skipping frames with an odd number, effectively halving the frame rate.
function onFrame(event) {
if (event.count % 2 === 0) {
//your code here
}
}
© 2022 - 2024 — McMap. All rights reserved.