This module is about showing joysticks.
Internal.Joystick.Joystick
A joystick is a representation of a stick that can move in all directions.
left : Internal.Gamepad.Gamepad -> Joystick
Get the joystick that usually resides on the left of the controller. This is considered the primary joystick on the controller.
The joystick's value can be read in multiple ways that might suit your needs.
abs : Joystick -> Basics.Float
On a scale from 0 to 1, return how intensely the joystick is being pushed away from the center.
This should be zero when the user doesn't touch their joystick, but that's often not the case. Joysticks get less accurate as the controller grows old, so you should expect this value to be near-zero rather than precisely zero.
direction : Joystick -> Basics.Int
Starting from the top, get a direction in terms of degress, starting at 0 from the top and going to 360 clockwise.
directionRad : Joystick -> Basics.Float
Same as direction, except the value is now a number between 0 and 1.
toXY : Joystick -> { x : Basics.Float, y : Basics.Float }
Convert a joystick's direction to an x and y value. The coordinates are defined as is starting from the top left, so:
Both values go from -1 to 1, so (-1, -1) and (1, 1) are the top left and bottom right respectively.