Skip to content

$createCanvas

Creates a new canvas.

Usage

$createCanvas[canvas;width;height]

Parameters

FieldTypeDescriptionRequired
canvasStringName of the canvas to create.True
widthNumberWidth of the new canvas.True
heightNumberHeight of the new canvas.True

Example(s)

$attachCanvas[mycanvas;house.png]
$stroke[mycanvas;#03a9f4;10]
$closePath[mycanvas]
$lineTo[mycanvas;250;140]
$lineTo[mycanvas;150;60]
$moveTo[mycanvas;50;140]
$beginPath[mycanvas]
$fillRect[mycanvas;#03a9f4;130;190;40;60]
$strokeRect[mycanvas;#03a9f4;75;140;150;110;10]
$createCanvas[mycanvas;300;320]

showcase

Raw Info

{
"name": "$createCanvas",
"description": "Creates a new canvas.",
"params": [
{
"name": "canvas",
"description": "Name of the canvas to create.",
"type": "String",
"required": true
},
{
"name": "width",
"description": "Width of the new canvas.",
"type": "Number",
"required": true
},
{
"name": "height",
"description": "Height of the new canvas.",
"type": "Number",
"required": true
}
],
"usage": "$createCanvas[canvas;width;height]",
"example": "```aoi\n$attachCanvas[mycanvas;house.png]\n\n$stroke[mycanvas;#03a9f4;10]\n\n$closePath[mycanvas]\n$lineTo[mycanvas;250;140]\n$lineTo[mycanvas;150;60]\n$moveTo[mycanvas;50;140]\n$beginPath[mycanvas]\n\n$fillRect[mycanvas;#03a9f4;130;190;40;60]\n$strokeRect[mycanvas;#03a9f4;75;140;150;110;10]\n\n$createCanvas[mycanvas;300;320]\n```\n\n![showcase](https://lam.k4scripts.xyz/cdn/aoicanvas/examples/house.png)",
"category": "canvas",
"src": "https://github.com/devlordduck/aoi.canvas/tree/v2/src/functions/canvas/createCanvas.ts",
"docs": "https://aoicanvas.vercel.app/functions/createcanvas"
}