RenderConfig
The renderConfig
object allows developers to customize the rendering settings for animations.
Properties
Property | Type | Required | Default | Description |
---|---|---|---|---|
devicePixelRatio | number | No | window.devicePixelRatio * 0.75 if DPI > 1, else 1 | Controls the pixel ratio for rendering. On high-DPI displays (window.devicePixelRatio > 1 ), the pixel ratio is scaled down to 75% of the device’s pixel ratio. On standard displays, the default is 1 . |
freezeOnOffscreen | boolean | No | true | Freezes animation when offscreen to conserve resources, and resumes the animation when they are visible again. |
autoResize | boolean | No | false | Automatically adjusts the animation size when the canvas element is resized. |
devicePixelRatio
Explained
The devicePixelRatio
property is used to control the resolution at which animations are rendered. The default behavior is as follows:
- High-DPI displays (
window.devicePixelRatio > 1
): ThedevicePixelRatio
is set to 75% of the device’s native pixel ratio to optimize performance on higher resolution displays without significantly impacting visual quality.- Example: If
window.devicePixelRatio
is 2, thedevicePixelRatio
will default to2 * 0.75 = 1.5
.
- Example: If
- Standard displays (
window.devicePixelRatio <= 1
): ThedevicePixelRatio
is set to1
, ensuring the animations are rendered at their native resolution.
For more information on window.devicePixelRatio
, refer to the MDN documentation.