Change frame rate in paper.js
Asked Answered
C

1

8

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.

Cribble answered 15/1, 2015 at 16:43 Comment(0)
N
11

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
  }
}
Napiform answered 15/1, 2015 at 16:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.