The aim of the project is to create an easy to use analog stick library for PIXI.js.
$ npm install --save pixi-analog-stick
import * as PIXI from 'pixi.js';
import PixiAnalogStick from 'pixi-analog-stick';
class Container extends PIXI.Container {
constructor() {
super();
// AnalogStick
this._analogStick = new PixiAnalogStick();
this._analogStick.on('move', this._onMoveStick);
this._analogStick.on('release', this._onReleaseStick);
this.addChild(this._analogStick);
}
_onMoveStick = (stickData) => {
console.info('move', stickData);
};
_onReleaseStick = () => {
console.info('release', stickData);
};
}
export default Container;
on(eventName:String, handler:Function)
Use to add events.
off(eventName:String, handler:Function)
Use to remove events.
reset()
Reset stick position.
dispose()
Use to dispose pixi-analog-stick.
move
Emit "move" event when move stick.
Property
release
Emit "release" event when stick is released.