Canvasprops

[中文]

Overview

canvasProps applies to canvas.

Field Table

Key

Type

Default

Binding

UI Effect / Limits

commands

CanvasCommand[]

[]

canvasProps.commands

declarative drawing command list

Canvascommand Field Table

Key

Type

Default

Description

type

string

""

command type

x

integer px

0

start point or rectangle X coordinate

y

integer px

0

start point or rectangle Y coordinate

width

integer px

0

width

height

integer px

0

height

color

string, "#RRGGBB"

""

command color

Canvascommand Type

Currently exposed command types:

Value

Meaning

Fields used

fill

fill the entire canvas background with color

color

pixel

set a pixel at (x, y)

x, y, color

width / height are currently accepted by the parser but not yet used during command execution. A type that is not listed is ignored.

Example

"canvasProps": {
    "commands": [
        {
            "type": "fill",
            "color": "#3b82f6"
        },
        {
            "type": "pixel",
            "x": 12,
            "y": 8,
            "width": 0,
            "height": 0,
            "color": "#ffffff"
        }
    ]
}