@sflabs/pixi-joystick
v6.0.4
Published
## Usage
Downloads
8
Readme
pixi-joystick
Usage
import { Joystick } from '@sflabs/pixi-joystick';
const joystick = new Joystick(app.stage, { x: 44, y: 44 });
joystick.onStart(() => {
console.log('start');
});
joystick.onChange((angle, power) => {
console.log(angle, power);
// Radians
console.log(joystick.angle);
// From 0 to 1
console.log(joystick.power);
}, 500);
joystick.onEnd(() => {
console.log('end');
});
setTimeout(() => {
joystick.x = 88;
joystick.y = 88;
}, 5_000);
setTimeout(() => {
joystick.destroy();
}, 10_000);