@grida/canvas-wasm 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -13
- package/dist/grida-canvas-wasm.js +13 -7944
- package/dist/grida_canvas_wasm.wasm +0 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1929 -3606
- package/dist/index.mjs +1925 -3606
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,23 +12,16 @@ pnpm install @grida/canvas-wasm
|
|
|
12
12
|
import init from "@grida/canvas-wasm";
|
|
13
13
|
|
|
14
14
|
const factory = await init({
|
|
15
|
-
// locate the wasm binary file
|
|
15
|
+
// locate the wasm binary file (location may vary by version)
|
|
16
|
+
// e.g. this will resolve to https://unpkg.com/@grida/canvas-wasm@0.0.2/dist/grida_canvas_wasm.wasm
|
|
16
17
|
locateFile: (path) =>
|
|
17
|
-
`https://unpkg.com/@grida/canvas-wasm@<VERSION
|
|
18
|
+
`https://unpkg.com/@grida/canvas-wasm@<VERSION>/${path}`,
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
// your canvas element
|
|
21
|
-
const canvas = document.
|
|
22
|
-
const
|
|
23
|
-
antialias: true,
|
|
24
|
-
depth: true,
|
|
25
|
-
stencil: true,
|
|
26
|
-
alpha: true,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const scene = factory.createSurface(context, 100, 100);
|
|
22
|
+
const canvas = document.getElementById("canvas") as HTMLCanvasElement;
|
|
23
|
+
const scene = factory.createWebGLCanvasSurface(canvas);
|
|
30
24
|
|
|
31
25
|
// ready to draw
|
|
32
|
-
scene.
|
|
33
|
-
scene.redraw();
|
|
26
|
+
scene.loadDummyScene();
|
|
34
27
|
```
|