-
Notifications
You must be signed in to change notification settings - Fork 282
Home
#Key Concepts of Maker.js
Maker.js lets you design shapes with JavaScript code. These shapes have only outlines. Shapes are made from primitive outlines called Paths. There are 3 primitive Paths: line, circle, and arc. Paths are defined by Points and other properties. A group of paths may be contained in what is called a Model. A Model may then contain other Models.
There is no concept of contiguity between paths.
POJO's: Plain old JavaScript objects are used to design your model. To make this work, these plain objects must conform to a schema.
{ x: number, y: number }
var myPoint = { x: 42, y: 99 };
Paths must contain these properties at a minimum:
- type: string
- id: string
- origin: Point
{ type: "line", id: string, origin: Point, end: Point }
var myLine = { type: "line", id: "myLine1", origin: { x: 0, y: 0 }, end: { x: 42, y: 99 } };
{ type: "circle", id: string, origin: Point, radius: number }
var myCircle = { type: "circle", id: "myCircle1", origin: { x: 0, y: 0 }, radius: 13 };
{ type: "arc", id: string, origin: Point, radius: number, startAngle: number, endAngle: number }
var myArc = { type: "arc", id: "myArc1", origin: { x: 0, y: 0 }, radius: 4.2, startAngle: 45, endAngle: 135 };