/virtualjoystick.js

a virtual joystick library to emulate a joystick on touch screen in javascript

Primary LanguageJavaScriptMIT LicenseMIT

virtualjoystick.js

It is small library to emulate a virtual joystick for touchscreen. Here is a basic example and its source. Here is a dual joystick example and its source.

see "Let’s Make a 3D Game: Virtual Joystick" post on "learningthreejs blog".

How To Install It

You can install it manually. Just do

<script src='virtualjoystick.js'></script>

You can install with bower.

bower install virtualjoystick.js

then you add that in your html

<script src="bower_components/virtualjoystick.js/virtualjoystick.js"></script>

How To Use It ?

  • opts.container is the dom element on which we display joystick
  • opts.stickElement is the dom element which is display for the stick of the joystick.
  • opts.baseElement is the dom element which is display for its base.
  • Both elements are optional with sensible default
  • you may set opts.mouseSupport to true during debug.