-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
Is using
setTimeout(0)in an infinite loop still the recommended way to draw every frame? I want to do animation and motion using@napi-rs/canvas, and when using this code withsetTimeout(0):window.render(pixelWidth, pixelHeight, pixelWidth * 4, 'rgba32', canvas.data(), { scaling: 'linear', dstRect: { x: 0, y: 0, width: pixelWidth, height: pixelHeight }, })the FPS I'm seeing fluctuates a lot around at 60. At times it even goes to 70 or reduces to 30. If I use skia-canvas' own Window, I get a proper 60±1 FPS.
Am I doing something wrong here? Or is this expected?
Originally posted by @ajitid in #52
I can't reproduce that on my system so I'm splitting it into a new issue.
By default the windows created by @kmamal/sdl have vsync enabled so your framerate should match your monitor refresh rate. Can you share more details about your setup?
- What OS?
- Are you running the example as-is or have you made modifications?
- What are the values of
window.acceleratedandwindow.vsync?
Metadata
Metadata
Assignees
Labels
No labels