Draw (candraw)
Loading
import { createCanvasController } from "@pixxl-tools/candraw";
const canvas = createCanvasController({
document: {
"schema": "pixxl.canvas.document",
"version": 1,
"canvas": { "width": 960, "height": 640 },
"pages": [{ "id": "page-1", "name": "Page 1", "x": 0, "y": 0, "width": 960, "height": 640 }],
"elements": []
},
});
canvas.transaction(() => {
canvas.dispatch({
type: "candraw/rectangle/add",
transform: { x: 24, y: 24, width: 160, height: 96 },
});
canvas.dispatch({
type: "candraw/ellipse/add",
transform: { x: 220, y: 40, width: 96, height: 96 },
});
});
const document = canvas.getDocument();
canvas.destroy();