Skip to content
mohayonao edited this page Aug 11, 2014 · 9 revisions

rect

Draws a rectangle to the canvas.

Examples

canvas.stroke(8).noFill()
  .rect(20, 20, 60, 60);

canvas.noStroke().fill([ 1, 9, 6 ])
  .rect(120, 20, 60, 60);

canvas.stroke(10).fill(2)
  .rect(220, 20, 60, 60);

Syntax

canvas.rect(x, y, w, h);

Parameters

  • x: int
    • x-coordinate of the rectangle
  • y: int
    • y-coordinate of the rectangle
  • w: int
    • width of the rectangle
  • h: int
    • height of the rectangle

Returns

Canvas: self for method chaining

Related