Giter Club home page Giter Club logo

virtualjoystick.js's Introduction

virtualjoystick.js

It is small library to emulate a virtual joystick for touchscreen. For details, see "Let’s Make a 3D Game: Virtual Joystick" post on "learningthreejs blog".

Show Don't Tell

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.
  • you may set opts.stationaryBase to true for a permanent Stationary joystick base.
  • if you do use a stationary base, you must also set opts.baseX to the desired X-coordinate on the webpage and opts.baseY to the desired Y-coordinate. The joystick base will now be fixed at this location.
  • you may set opts.limitStickTravel to true in order to limit the distance that the stick can travel from its base. This will create an invisible circle barrier that the stick cannot leave.
  • if you do use opts.limitStickTravel , you can also set opts.stickRadius to the desired radius (in pixels). The stick will now be confined to stickRadius. If you do not set opts.stickRadius , it will default to 100 pixels radius.

virtualjoystick.js's People

Contributors

jeromeetienne avatar erichlof avatar phola avatar

Watchers

Richard Artoul avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.