File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # VectorJS
2+
3+ ## Example
4+ ``` js
5+ import {Application , Rectangle , Vector2 , Palette } from " vectorjs" ;
6+
7+ const screenWidth = 800 ;
8+ const screenHeight = 600 ;
9+ const fpsPos = new Vector2 (10 , 10 );
10+ const rect = new Rectangle (30 , 30 , 200 , 45 );
11+ const point1 = new Vector2 (400 , 150 );
12+ const point2 = new Vector2 (300 , 350 );
13+ const point3 = new Vector2 (500 , 350 );
14+
15+ const app = new Application (screenHeight, screenWidth, " Window" );
16+ app .run ({
17+
18+ onDraw (render ) {
19+ render .withLayer2D ((ctx ) => {
20+ ctx .drawFPS (fpsPos);
21+
22+ ctx .shapes .drawRectangle (rect, {
23+ color: Palette .RED
24+ })
25+
26+ ctx .shapes .drawCircle (point1, 60 , {
27+ color: Palette .GREEN
28+ })
29+
30+ ctx .shapes .drawTriangle (point1, point2, point3, {
31+ color: Palette .BLUE
32+ })
33+
34+ });
35+ }
36+ });
37+ ```
You can’t perform that action at this time.
0 commit comments