pixi-plugin-example
v2.0.0
Published
Example of PixiJS plugin
Readme
PixiJS plugin example
This is a demo project with collection of simple hacks for PixiJS.
You can make your own pixi plugin based on this repo.
Algorithms represented in this repo hack several parts of Pixi - you can take those ideas and expand them.
If you are that desperate, you can add use it through npm pixi-plugin-example:'=version', because we do not guarantee any back compatibility! This is not a plugin, its a tutorial!
How to make your own plugin for PixiJS
People will like the fact that you want to ease their life with with one line
import 'pixi-awesome-plugin'Follow the steps:
- Clone repo locally
- Create your own repository and copy all the code there
- Remove folders from
src, except those you want to use as base for plugin - Remove everything from
examples, leave examples that is close to what you want - Put your code in
src, example inexamples, test that it works - Replace all
pixi-plugin-exampleinpackage.jsonto your plugin name - Change version to
0.1.0or whatever you want - Change UMD namespace and file names in
examplesaccordingly - Make sure you use only necessary pixi plugins in
peerDependenciesanddevDependencies, they have to be the same! - Add/Remove GlobalMixins from
global.d.tsto hack pixi interfaces - Check that project builds
- Start web server here (like
http-server -c-1) and check that example works - Write a README, and publish your plugin to npm!
Extra tips:
- When you make changes and want to re-publish, you can use
npm run release:patchto change version of lib. - If you reference
@pixi/layersor some other plugins, changerollup.config.jsaccordingly, otherwise they'll be compiled inside your lib - remove all "lint"-related commands from
package.jsonif you don't like our code style or it obstructs you - Contact Ivan to add your plugin to PixiJS Wiki
List of demos
filterschanging FilterSystem for profit
That's enough for now :)
How to build
npm i
npm run buildVanilla JS, UMD build
All pixiJS v6 plugins has special umd build suited for vanilla.
Navigate pixi-plugin-example npm package, take dist/pixi-plugin-example.umd.js file.
<script src='lib/pixi.js'></script>
<script src='lib/pixi-plugin-example.umd.js'></script>Also, you can access CDN link, something like https://cdn.jsdelivr.net/npm/pixi-plugin-example@latest/dist/pixi-plugin-example.umd.js
all classes can be accessed through PIXI.example package.
How to contribute
Just make PR.
