mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
[ts][canvaskit] Fix headless example.
This commit is contained in:
parent
cb9bdc8294
commit
1f813f8c29
@ -3,7 +3,7 @@ import { fileURLToPath } from 'url';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import CanvasKitInit from "canvaskit-wasm";
|
import CanvasKitInit from "canvaskit-wasm";
|
||||||
import UPNG from "@pdf-lib/upng"
|
import UPNG from "@pdf-lib/upng"
|
||||||
import {loadTextureAtlas, SkeletonRenderer, Skeleton, SkeletonBinary, AnimationState, AnimationStateData, AtlasAttachmentLoader, Physics, loadSkeletonData, SkeletonDrawable} from "../dist/index.js"
|
import {loadTextureAtlas, SkeletonRenderer, loadSkeletonData, SkeletonDrawable} from "../dist/index.js"
|
||||||
|
|
||||||
// Get the current directory
|
// Get the current directory
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@ -19,10 +19,10 @@ async function main() {
|
|||||||
if (!surface) throw new Error();
|
if (!surface) throw new Error();
|
||||||
|
|
||||||
// Load atlas
|
// Load atlas
|
||||||
const atlas = await loadTextureAtlas(ck, __dirname + "/assets/spineboy.atlas", async (path) => fs.readFileSync(path));
|
const atlas = await loadTextureAtlas(ck, __dirname + "/../../assets/spineboy.atlas", async (path) => fs.readFileSync(path));
|
||||||
|
|
||||||
// Load the skeleton data
|
// Load the skeleton data
|
||||||
const skeletonData = await loadSkeletonData(__dirname + "/assets/spineboy-pro.skel", atlas, async (path) => fs.readFileSync(path));
|
const skeletonData = await loadSkeletonData(__dirname + "/../../assets/spineboy-pro.skel", atlas, async (path) => fs.readFileSync(path));
|
||||||
|
|
||||||
// Create a SkeletonDrawable
|
// Create a SkeletonDrawable
|
||||||
const drawable = new SkeletonDrawable(skeletonData);
|
const drawable = new SkeletonDrawable(skeletonData);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user