New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

purejoyjs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

purejoyjs

Virtual joystick with delegate function for JavaScript.

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

PureJoyJS

Virtual joystick with delegate function for JavaScript.

A simple, touch-friendly virtual joystick written in pure JavaScript, utilizing HTML Canvas for drawing and Pointer Events for input handling.

It's great for touch controls because it leverages the modern Pointer Events API, which unifies input from mouse, touch, and pen. This ensures a reliable and responsive experience across mobile devices, tablets, and even desktops with touchscreens, making it an ideal choice for implementing virtual game controls.

Usage example:

<head>
</head>
<body>
<script type="module">
    import { Joystick } from './node_modules/purejoyjs/joystick.js'

    let currentX = 0;
    let currentY = 0;
    let isDragging = false;
    let joystickId = null;

    function handleJoystickMove(id, x, y, dragging) {
        joystickId = id;
        currentX = x;
        currentY = y;
        isDragging = dragging;
    }

    function gameLoop() {
        if (joystickId !== null) {
            console.log(`handleJoystickMove: ${joystickId} ${currentX} ${currentY} ${isDragging}`);
        }

        joystick.draw()
        requestAnimationFrame(gameLoop);
    }

    const joystick = new Joystick("joystick", handleJoystickMove, 240)
    joystick.placeJoystickAt(0,0,1000)

    requestAnimationFrame(gameLoop);
</script>
</body>

Screenshot

Live Demo: https://demensdeum.com/software/cube-art-project-2-online/

Keywords

joystick

FAQs

Package last updated on 07 Oct 2025

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