Commands

Learn All Commands in canvas-lang

Commands

Background

Set the background color for the canvas:

background "color";

Colors can be named colors like "red", "blue", "green", or hex colors like "#FF5733".

Circle

Draw a circle:

circle at (x, y) radius r fill "color";
  • x, y: Coordinates for the center of the circle

  • r: Radius of the circle

  • color: Fill color

Rectangle

Draw a rectangle:

rect at (x, y) width w height h fill "color";
  • x, y: Coordinates for the top-left corner

  • w: Width of the rectangle

  • h: Height of the rectangle

  • color: Fill color

Text

Display text:

  • "Your text": The text to display

  • x, y: Coordinates for the text

  • s: Text size (affects font selection - larger values use larger fonts)

  • color: Text color

Line

Draw a line:

  • x1, y1: Starting coordinates

  • x2, y2: Ending coordinates

  • color: Line color

Rainbow Text

Display animated rainbow text:

  • "Your text": The text to display with rainbow animation

  • x, y: Coordinates for the text

  • duration: How long to run the animation (in cycles)

Variables

Define variables for reuse:

Wait

Pause execution:

Frames and Animation

Create frame-based animations:

Last updated