Skip to content

About

HTML5/Javascript mobile joystick

Resources

Stars

35 stars

Watchers

1 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

virtual-joystick

A lightweight virtual HTML5/Javascript mobile joystick

Virtual joystick

See a running example here: https://cptx032.github.io/virtual-joystick/

To create a virtual joystick is very simple:

// creates a centralized joystick
var joystick = new JoyStick({
	radius: 80,
	x: window.innerWidth / 2,
	y: window.innerHeight /2,
	inner_radius: 70
});

any time you want you can check the joystick status:

function check() {
	requestAnimationFrame( check );
	
	if ( joystick.up ) {
		console.log( 'walk character' );
	}
}
check();

Limitations

This project is just for very simple projects. It is not able to say the delta and configures the button's style, for example. If you want you can checkout https://github.com/yoannmoinet/nipplejs for a more complete solution

About

HTML5/Javascript mobile joystick

Resources

Stars

35 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages