Skip to content

xpatch/threex.keyboardstate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

threex.keyboardstate

it is a three.js extension to keep the current state of the keyboard. It is possible to query it at any time. No need of an event. This is particularly convenient in loop driven case, like in 3D demos or games.

Here is the basic example live and its source. Another one which handle norepeat keydown event and its source. Another one which use it standalone and its source.

How To Install It

You can install it manually. Just do

<script src='threex.keyboardstate.js'></script>

You can install with bower.

bower install threex.keyboardstate

How To Use It ?

Step 1: Create the object

var keyboard	= new THREEx.KeyboardState();

Step 2: Query the keyboard state

This will return true if shift and A are pressed, false otherwise

keyboard.pressed("shift+A")

Step 3: Stop listening to the keyboard

keyboard.destroy()

NOTE: this library may be nice as standaline. independant from three.js

About

three.js extension to keep the current state of the keyboard

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%