Gathering detailed insights and metrics for threejs-vr-keyboard
Gathering detailed insights and metrics for threejs-vr-keyboard
Gathering detailed insights and metrics for threejs-vr-keyboard
Gathering detailed insights and metrics for threejs-vr-keyboard
npm install threejs-vr-keyboard
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
89 Commits
3 Branches
Updated on Apr 19, 2021
Latest Version
1.0.9
Package Id
threejs-vr-keyboard@1.0.9
Unpacked Size
98.00 kB
Size
65.54 kB
File Count
5
NPM Version
6.0.0
Node Version
8.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A keyboard input based on THREE.js for virtual reality experiences or just as an alternative to the standard on-screen keyboard on touch devices.
Include THREE.js library and VRKeyboard:
<script src="libs/three.min.js"></script>
<script src="js/VRKeyboard.js"></script>
Create a basic 3D scene:
<script>
var container;
var camera;
var scene, renderer;
var vrKeyboard;
function init(element){
container= document.getElementById(element);
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20000);
scene = new THREE.Scene();
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
camera.position.set(0, 0, 1500);
camera.lookAt(new THREE.Vector3(0,0,0))
animate();
}
function animate(){
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
</script>
<body onload="init('container')">
<div id="container"></div>
</body>
Instantiate a VRKeyboard passing a reference to current scene, camera and renderer:
var vrKeyboard = new VRKeyboard(scene, camera, renderer)
Call the VRKeyboard update in the rendering loop:
function animate(){
vrKeyboard.update()
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
Listen for events:
vrKeyboard.addEventListener("keydown", function(e){
console.log("You pressed the: "+e.code+" key")
}
Supported events are:
Add and layout VRTextInput instances as necessary, for example:
var usernameTxt = new VRTextInput();
usernameTxt.width = 400;
usernameTxt.position.set(0,300,0);
var passwordTxt = new VRTextInput();
passwordTxt.width = 400
passwordTxt.position.set(0,220,0);
passwordTxt.displayAsPassword = true;
Register VRTextInput instances to the VRKeyboard:
vrKeyboard.addField(usernameTxt);
vrKeyboard.addField(passwordTxt);
Registered fields automatically receive focus when clicked.
To set focus programmatically assign it as target of the VRKeyboard:
vrKeyboard.target = usernameTxt;
Then type something and get the VRTextInput value, e.g.:
vrKeyboard.addEventListener("keydown", function(e){
if(e.code == Unicode.ENTER){
console.log(usernameTxt.value);
}
}
VRKeyboard exposes the following attributes for basic customization:
Example:
//Red key background with yellow labels and no rounded corners
vrKeyboard.keyColor="#D90000";
vrKeyboard.labelColor="#FFD24D";
vrKeyboard.borderColor="#FFD24D";
vrKeyboard.keyDownColor="#B20000";
vrKeyboard.labelDownColor="#FFBF00";
vrKeyboard.borderDownColor="#D90000";
vrKeyboard.borderRadius=0
VRTextInput styling woks similar:
//Red background with yellow text and no rounded corners
searchTxt.backgroundColor="#D90000";
searchTxt.textColor="#FFD24D"
searchTxt.borderColor="#FFD24D";
searchTxt.backgroundFocusColor="#B20000";
searchTxt.textFocusColor="#FFBF00"
searchTxt.borderFocusColor="#FF0000";
searchTxt.borderRadius=0
If you want to go more in depth on styling and customizing, have a look at the draw() and drawKey() methods.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
1 existing vulnerabilities detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More