Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aframe-keyboard-controls

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-keyboard-controls

Keyboard controls for A-Frame.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

A-Frame keyboard-controls Component

Keyboard controls for A-Frame.

Overview

Bindings and events for keyboard controls on an A-Frame VR scene. When combined with ProxyControls.js (with the proxy-controls component for A-Frame), can also receive remote keyboard input by WebRTC.

Usage

Movement + keyboard events:

<a-scene>
  <a-entity camera
            keyboard-controls>
  </a-entity>
</a-scene>

Keyboard events only (no movement):

<a-scene>
  <a-entity camera
            keyboard-controls="enabled: false">
  </a-entity>
</a-scene>

Usage + Remote Device

ProxyControls.js ⇢ Docs

Example:

<a-scene proxy-controls>
  <a-entity camera
            keyboard-controls>
  </a-entity>
</a-scene>

Check Keyboard State

To check the pressed/unpressed state of a given Keyboard.code, use the isPressed() method:

var keyboardControls = el.components['keyboard-controls'];
keyboardControls.isPressed('ArrowLeft');

Events

keyboard-controls comes with a polyfill guaranteeing support for KeyboardEvent.key and KeyboardEvent.code. When a keydown or keyup event is detected, an extra event is created with the code attached. Example usage:

<a-entity keyboard-controls
          sound="src: reload.wav;
                 on: keydown:KeyR">
</a-entity>

A complete list of code values may be found here.

Known Issues

In OS X, pressing the Command/Meta (⌘) key blocks all other key events. For example, pressing A, pressing , releasing A, and then releasing would create a keyup:KeyA event, but no keyup:KeyA. This seems to be unavoidable. Because of this, I do not recommend using the Command/Meta key in your apps.

Keywords

FAQs

Package last updated on 07 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc