PixiJs 是比较常用的 canvas 库,用来展示 2d 的平面图,相比 canvas,封装了更多的功能,也更简单容易上手,但是其官网的文档写得极其的简陋,可阅读性很差,综合了一些其他的文档,写出了这份极简教程,让小白也可以拿来即用。
一、创建画布
let Application = PIXI.Application, loader = PIXI.Loader.shared, resources = PIXI.Loader.shared.resources, Texture = PIXI.Texture, TextureCache = PIXI.utils.TextureCache, Rectangle = PIXI.Rectangle, Sprite = PIXI.Sprite;
let app = new Application({ width: 256, height: 256, antialiasing: true, transparent: false, resolution: 1, });
this.$refs.container.appendChild(app.view);
|