UNPKG

@avolutions/canvas-painter

Version:

CanvasPainter.js is a simple yet powerful JavaScript library for drawing basic shapes (rectangles, circles, etc.) on HTML5 Canvas with ease. Perfect for creating 2D graphics in your web projects.

30 lines (29 loc) 889 B
import { ShapeDefinition } from "./ShapeDefinition.js"; /** * Class representing a Rectangle definition. */ export class RectangleDefinition extends ShapeDefinition { /** The position of the rectangle. */ position; /** The width of the rectangle. */ width; /** The height of the rectangle. */ height; /** The angle of the rectangle. */ angle; /** * Creates a new instance of RectangleDefinition. * * @param position - The position of the rectangle (top-left or center). * @param width - The width of the rectangle. * @param height - The height of the rectangle. * @param angle - The angle of the rectangle in degrees. */ constructor(position, width, height, angle) { super(); this.width = width; this.height = height; this.position = position; this.angle = angle; } }