This page is in development! This Class is in development!
Vas.shapes allows you to draw basic shapes to the canvas. This class is in early stages of development, and will require more testing before exact documentation.
The current Shapes are: rectangle (Vas.shapes.rect), circle (Vas.shapes.circle), and polygon (Vas.shapes.poly).
Usage is as followed:
//Using Vas.shapes (beta class)
Vas.shapes.rect(x, y, width, height, color); //Draws a rectangle
Vas.shapes.circle(x, y, radius, color); //Draws a circle
Vas.shapes.poly(x, y, number_of_sides, size_as_radius, color); //Draws a polygon
You can also use an object to create shapes with vas. Make sure you use Vas.shape(), not Vas.shapes.type(). They require a type, and their respective parameters and color is optional:
- Rectangle: type, x, y, w, h
- Circle: type, x, y, r
- Poly: type, x, y, N, size
- Stroke: type, points(minimum of two)
//Using Vas.shape
Vas.shape({type: "rect", x: 0, y: 0, w: 100, h: 100, color: 'red'}) //Creates a rectangle
Vas.shape({type: "circle", x: 0, y: 0, r: 10, color: 'blue'}) //Creates a circle
Vas.shape({type: "poly", x: 0, y: 0, N: 5, size: 10}) //Creates a polygon
Vas.shape({type: "stroke", points:[[0, 0], [10, 0], [10, 10], [0, 10]]}) //Custom Shape