如何导入类库?

时间:2019-05-25 15:25:39

标签: webpack import createjs spine

我有带有Webpack的React应用,我需要实现spine-animations。 我使用CreateJs,并且想将Spine类(https://github.com/Lavrend/createjs-spine)导入CreateJs。

首先,我导入了createjs和spine

function distance(p) {
    return Math.sqrt(Math.pow(point.x - p.x, 2) + Math.pow(point.y - p.y, 2))
}

var point = { x: 10000, y: 10000 },
    points = [{ x: 35, y: 10001 }, { x: 2478, y: 38 }],
    closest = points.reduce((a, b) => distance(a) < distance(b) ? a : b);

console.log(closest);

然后我尝试使用spine,但是我做不到。

import createjs from 'createjs';
import {spine} from '../../../../vendors/Spine';

我有一个错误

let stage = new createjs.Stage('myCanvas');
  let dragon = new createjs.spine("./ship_1_col_1.atlas", "./ship_1_col_1.json");

如何将spine作为方法添加到createjs?

0 个答案:

没有答案
相关问题