-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* The range of canvas is fixed to the size [100, 100]. | ||
* | ||
* The variables shown below are available in the global scope: | ||
* import {Path} from 'pathed' | ||
* import {scalar, vec2, mat2d} from 'linearly' | ||
* | ||
* // The 2D context of the canvas | ||
* context: CanvasRenderingContext2D | ||
* | ||
* // Draws a stroke with the given path | ||
* draw: (path: Path, color: string, width: number) => void | ||
*/ | ||
|
||
const c = Path.circle([50, 50], 40) | ||
draw(c, 'PaleGreen', 1) | ||
|
||
const r = Path.rectangle([10, 10], [50, 50]) | ||
draw(r, 'PowderBlue') | ||
|
||
const t = Path.regularPolygon([50, 50], 40, 5) | ||
draw(t, 'MediumSlateBlue') | ||
|
||
const b = Path.cubicBezierTo( | ||
Path.moveTo([], [10, 50]), | ||
[10, 100], | ||
[90, 0], | ||
[90, 50] | ||
) | ||
draw(b, 'plum') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export default new Map<string, string>([['circle', 'console.log(10)']]) | ||
import Primitives from './Primitives?raw' | ||
|
||
export default new Map<string, string>([['Primitives', Primitives]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*?raw' { | ||
const content: string | ||
export default content | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
"pathed": ["./src/index.ts"] | ||
} | ||
}, | ||
"include": ["."] | ||
"include": ["./**/*.ts", "./**/*.js"] | ||
} |