g.js — graphical objects for JavaScript

rectrect

Create a rectangle or square.

g.rect({x: 0, y: 0}, 100, 100);

An optional fourth parameter specifies the corner roundness:

g.rect({x: 0, y: 0}, 100, 100, 10);

Parameters

  • position: The center point of the rectangle.
  • width: The width of the rectangle.
  • height: The height of the ellipse.
  • roundness: The roundness of the rectangle.