Vue 3 Pixi
Vue createRenderer for PixiJS
Features β
- π Lightweight and flexible Vue 3 library for creating PixiJS applications.
- βοΈ Provides a Custom Vue Renderer that creates PixiJS objects instead of HTML elements.
- π¦ Supports all PixiJS objects, such as
Filter
,Container
,Sprite
,Graphics
,Text
, etc - π§βπ» Support specifying
texture
paths in templates to load texture objects - β¨ All events emitted by PixiJS objects are supported
- ποΈ Offers Loader component for bundling assets and Feature Rich Composition Utilities.
- π« Create different transition effects in conjunction with Transition.
It is still a work in progress but it should be usable enough for real projects. If you run into any problems please donβt hesitate to create an issue on GitHub.
Install β
bash
npm install pixi.js vue3-pixi
npm install pixi.js vue3-pixi
bash
yarn add pixi.js vue3-pixi
yarn add pixi.js vue3-pixi
bash
pnpm add pixi.js vue3-pixi
pnpm add pixi.js vue3-pixi
Initialize vue plugin β
add Vue plugin configuration to support custom elements, prevent parsing exceptions, and support parsing the texture attribute, just like the src attribute of an img.
ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { compilerOptions, transformAssetUrls } from 'vue3-pixi'
export default defineConfig({
plugins: [
vue({
template: {
// support for custom elements and remove the unknown element warnings
compilerOptions,
// support for asset url conversion
transformAssetUrls,
},
}),
],
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { compilerOptions, transformAssetUrls } from 'vue3-pixi'
export default defineConfig({
plugins: [
vue({
template: {
// support for custom elements and remove the unknown element warnings
compilerOptions,
// support for asset url conversion
transformAssetUrls,
},
}),
],
})
Try it Online β
You can fork this template example on StackBlitz and play with it π without installing anything locally.