Class VirtualJoystick
Hierarchy
- VirtualJoystick
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new virtual joystick
Parameters
-
Optional leftJoystick: boolean
defines that the joystick is for left hand (false by default)
-
Optional customizations: Partial<VirtualJoystickCustomizations>
Defines the options we want to customize the VirtualJoystick
Returns VirtualJoystick
-
Properties
delta PositionSearch playground for deltaPosition
Gets the offset value for the position (ie. the change of the position value)
limit ToContainerSearch playground for limitToContainer
boolean indicating whether or not the joystick's puck's movement should be limited to the joystick's container area
pressedSearch playground for pressed
Gets a boolean indicating if the virtual joystick was pressed
reverse Left RightSearch playground for reverseLeftRight
Gets or sets a boolean indicating that left and right values must be inverted
reverse UpDownSearch playground for reverseUpDown
Gets or sets a boolean indicating that up and down values must be inverted
Static CanvasSearch playground for Canvas
Canvas the virtual joystick will render onto, default z-index of this is 5
Accessors
always Visible
-
Defines whether or not the joystick container is always visible
Returns boolean
-
Defines whether or not the joystick container is always visible
Parameters
-
value: boolean
Returns any
-
container Size
-
Size of the joystick's container
Returns number
-
Size of the joystick's container
Parameters
-
newSize: number
Returns any
-
puck Size
-
Size of the joystick's puck
Returns number
-
Size of the joystick's puck
Parameters
-
newSize: number
Returns any
-
Methods
clear PositionSearch playground for clearPosition
-
Clears the set position of the joystick
Returns void
release CanvasSearch playground for releaseCanvas
-
Release internal HTML canvas
Returns void
set Action OnTouchSearch playground for setActionOnTouch
-
Defines a callback to call when the joystick is touched
Parameters
-
action: () => any
defines the callback
-
-
Returns any
-
-
Returns void
-
set Axis For Left RightSearch playground for setAxisForLeftRight
-
Defines which axis you'd like to control for left & right
Parameters
-
axis: JoystickAxis
defines the axis to use
Returns void
-
set Axis For UpDownSearch playground for setAxisForUpDown
-
Defines which axis you'd like to control for up & down
Parameters
-
axis: JoystickAxis
defines the axis to use
Returns void
-
set Container ImageSearch playground for setContainerImage
-
Loads
urlPath
to be used for the container's imageParameters
-
urlPath: string
defines the urlPath of an image to use
Returns void
-
set Joystick ColorSearch playground for setJoystickColor
-
Change the color of the virtual joystick
Parameters
-
newColor: string
a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000")
Returns void
-
set Joystick SensibilitySearch playground for setJoystickSensibility
-
Defines joystick sensibility (ie. the ratio beteen a physical move and virtual joystick position change)
Parameters
-
newJoystickSensibility: number
defines the new sensibility
Returns void
-
set PositionSearch playground for setPosition
-
Sets the constant position of the Joystick container
Parameters
-
x: number
X axis coordinate
-
y: number
Y axis coordinate
Returns void
-
set Puck ImageSearch playground for setPuckImage
-
Loads
urlPath
to be used for the puck's imageParameters
-
urlPath: string
defines the urlPath of an image to use
Returns void
-
Class used to define virtual joystick (used in touch mode)