Change frame rate in paper.js

In Paper.js, is it possible to change the frame rate of the onFrame(event) function? The textbook on paper.js says that the default function is called 60 times per second, but it does not include, if possible (and how) to change the frame rate of this function.

+7
source share
1 answer

No, but you can easily skip frames in the code inside the onFrame function.


Example:

The following code emulates a frame rate of 30 frames per second, skipping frames with an odd number, effectively doubling the frame rate.

 function onFrame(event) { if (event.count % 2 === 0) { //your code here } } 
+10
source

Source: https://habr.com/ru/post/981064/


All Articles