0.0.9 • Published 5 years ago
canvas-joystick v0.0.9
Canvas Joystick
Usage :
const joystick = new Joystick()
// on press
const pointerPosition = { x: [number], y: [number] }
joystick.setStartPosition(pointerPosition)
// while the pointer is pressed
const pointerPosition = { x: [number], y: [number] }
joystick.setPointerPosition(pointerPosition)
// get force
const force = joystick.getAxisValues() // { x: [number], y: [number] }
// render
joystick.render()
// parameters
joystick.setScale([number])
// methods
joystick.hide()
joystick.show()
// getters
joystick.getStartPosition()
joystick.getPointerPosition()
joystick.getScale()