npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aframe-virtual-joystick

v1.1.52

Published

A virtual joystick component for A-Frame, enabling touch-based movement

Readme

aframe-virtual-joystick

aframe-virtual-joystick is an A-Frame component that integrates a virtual joystick into your VR scene. This joystick enables easy navigation in VR environments, especially for mobile and touch-based devices. The joystick can be customized to fit the look and feel of your application.

Installation

You can install the package via npm:

npm install aframe-virtual-joystick

Alternatively, you can include the script tag in your HTML file:

<script src="https://cdn.jsdelivr.net/npm/aframe-virtual-joystick/dist/aframe-virtual-joystick.js"></script>

Then, import the package into your A-Frame project:

import 'aframe-virtual-joystick';

Usage

To use the joystick component in your A-Frame scene, ensure to add id="camera" to your camera element, or create a new camera entity with id="camera":

<a-entity camera id="camera" position="0 1.6 0" look-controls wasd-controls></a-entity>

Example 1 (Default):

<a-scene>
  <!-- Camera for navigating with the joystick -->
  <a-entity id="camera" camera look-controls wasd-controls></a-entity>

  <!-- Joystick component setup -->
  <a-entity joystick></a-entity>
</a-scene>

This setup makes the virtual joystick follow the default behavior. The left half of the touch screen will be reserved for movement, similar to most modern games.

Example 2 (Custom Parameters):

<a-scene>
  <!-- Camera for navigating with the joystick -->
  <a-entity id="camera" camera wasd-controls></a-entity>

  <!-- Joystick component setup -->
  <a-entity 
    joystick="joystickAreaStyle: position:fixed; display:block; width:40%; height:100%; left:0px; bottom:0px; background-color:rgba(0,0,0,0.1); z-index:20;
              textOverlayStyle: position:fixed; bottom:0px; left:10px; font-size:14px Arial; opacity:0.3;
              textContent: Use joystick to move;
              speedReductionFactor: 50;">
  </a-entity>
</a-scene>

This example demonstrates how to customize the joystick's appearance and behavior.

Component Parameters

The joystick component supports various parameters for customization. You can either pass these parameters directly in the HTML or use the default settings.

Available Parameters

  • joystickAreaStyle: Customize the joystick area with CSS. Control the dimensions, position, background, and appearance of the joystick. Dragging on this area will trigger the movement joystick For example:

    "position:fixed; display:block; width:40%; height:100%; left:10px; bottom:10px; background-color:rgba(255,255,255,0.1); z-index:20;"
  • textOverlayStyle: Customize the text overlay appearance with CSS, controlling the font, position, size, and opacity. Example:

    "position:fixed; bottom:10px; left:10px; font-size:14px Arial; opacity:0.5;"
  • textContent: Set the text displayed on the joystick overlay (useful for instructions). For example:

    "Use joystick to navigate"
  • speedReductionFactor: Controls the movement speed relative to the joystick force. Higher values reduce speed, while lower values increase speed. Default is 50.

Default Parameters

  • joystickAreaStyle (string):

    "position:fixed; display:block; width:50%; height:100%; left:0px; bottom:0px; background-color:rgba(0,0,0,0); z-index:20;"

    by default the left half of the screen is reserved as joystickArea

  • textOverlayStyle (string):

    "position:fixed; bottom:0px; left:0px; margin-top:99%; font-size:12px Roboto; opacity:.3;"

    it is supposed to be shown on the bottom region

  • textContent (string): "" (no text by default)

  • speedReductionFactor (number): 50 (lower values increase speed)

Event Binding

The joystick component uses NippleJS for event handling. Events such as move and end are bound to provide a responsive and interactive experience. moveData is updated with the joystick’s force and angle, which are then used to adjust the camera's position.

Example Configuration

Here’s an example that demonstrates all parameters with custom values:

<a-entity 
  joystick="joystickAreaStyle: position:fixed; display:block; width:40%; height:100%; left:0px; bottom:0px; background-color:rgba(0,0,0,0.1); z-index:20;
            textOverlayStyle: position:fixed; bottom:0px; left:10px; font-size:14px Arial; opacity:0.3;
            textContent: Use joystick to move;
            speedReductionFactor: 30;">
</a-entity>

Notes

  • The joystick component checks for touch capability. It only initializes if the device supports touch events.
  • The joystick component assumes that there’s an element with the camera ID in the scene.

License

This project is licensed under the MIT License.