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 🙏

© 2024 – Pkg Stats / Ryan Hefner

roccatvulcan

v0.1.7

Published

Control your Roccat Vulcan Keyboard

Downloads

23

Readme

Roccat Vulcan API

With this Node Module you can control your Roccat Vulcan Keyboard. Bring your keyboard to life!

Demo / Video

This module was developed for an interactive data visualisation. Have a look:

Installation

Install per npm
npm install roccatvulcan
or clone repository
git clone [email protected]:simonhuwiler/roccatvulcan.git

Usage

Important: Close your Roccat Swarm App (right click -> close)

//Load module
const RoccatVulcan = require('roccatvulcan');

//Init Keyboard
keyboard = new RoccatVulcan({
  layout: 'ch-de',
  ready: () => {
    console.log("Keyboard is ready!");

    //Set every key to yellow
    keyboard.fillAll('#ffcc00');

    //Send new colors to keyboard
    keyboard.render();
  }
});

Init Parameters

productId (optional)
The Api will search automaticly for your keyboard. Although it may be possible, that your keyboard version is unknown. Then you need to provide a productId. If the keyboard is not found, you will see all possible devices in your terminal. Copy the Id of the corresponding one.

layout
The keyboard layout. Supported layouts:

  • ch-de for Swiss
  • de-de for Germany (thanks to Erik!)

Add your own support by duplicating and editing the folder keyboardlayout/ch-de!

ready (optional)
Callback after keyboard is initialised.

onData (optional) Callback when key pressed

Render-Methods

When ever you change the colors of a key, the api will store every key in the memory. The api will not send the new colors to the keyboard by itself, you need to render the current state. Two methods will help you:

Single rendering

keyboard.render()

This will send all the current colors to the keyboard

Auto rendering

keyboard.renderStart(50);

This will start continous rendering every 50 millisecond.

keyboard.renderStop();

Stops the auto renderer.

Coloring-Methods

Fill all

fillAll(color)

Will colorize each key. Be aware: Only hex-colors are supported. No blue or black.

// Example
keyboard.fillAll('#ffcc00');

Update Keys

updateKeys(keys, color[, backgroundColor])

Will only update the given keys, all other keys will remain the same. Except: backgroundColor is given!
Params:

  • keys: List of Keys
  • color: New color in hex
  • backgroundColor: optional. Changes the color of all other keys
// Example
keyboard.updateKeys(['W', 'A', 'S' ,'D'], '#ff0000')

Update Key

updateKey(key, colors[, backgroundColor])

Same as updateKeys but takes only one key.

// Example
keyboard.updateKey('W', '#ff0000')

Animate Keys

animateKeys(keys, colorFrom, colorTo, duration)

Creates a transition between two colors. Be aware: Auto Rendering needs to be running!
Params:

  • keys: List of Keys to animate
  • colorFrom: Start color
  • colorTo: End Color
  • duration: Duration in Miliseconds
// Example
keyboard.animateKeys(['W', 'A', 'S', 'D'], '#000000', '#ff0000', 1000);

Animate Key

animateKey(key, colorFrom, colorTo, duration)

Same as above with single key

// Example
keyboard.animateKeys('W', '#000000', '#ff0000', 1000);

Write Text (Experimental!)

write(text, color, keyOffset)`

Writes given Text on the keyboard. Only a few keys are currently supported! Have a look at keyboardlayout/ch-de/alphabet.js

// Example
keyboard.write("ANNA", '#ff0000', 20)

Marquee (Experimental!)

marquee(text, color, speed)

Writes text the same way as write but let the text scroll over the keyboard. Like the old HTML-Tag marquee. Only a few keys are currently supported! Have a look at keyboardlayout/ch-de/alphabet.js

// Example
keyboard.marquee("ANNA", '#ff0000', 200);

AnimationQueue

You can queue animations and run them at will. Use the AnimationQueue for that purpose.

Add Animation to Queue

keyboard.animationQueueAdd(animation, timeout);

Params:

  • animation: Function which will be triggered.
  • timeout: After how many milliseconds after the last animation this animation should be triggered

Start Animation Queue

keyboard.animationQueueStart(onFinish)

Starts the Animation Queue and will trigger onFinish after all animations have finished

Stop and Clear Animation Queue

keyboard.animationQueueStop()

Example

This will change the colors of the Keys AWSD.

keyboard.animationQueueAdd(() => this.keyboard.animateKeys(['W', 'A', 'S', 'D'], '#000000', '#ffcc00', 2000), 0);
keyboard.animationQueueAdd(() => this.keyboard.animateKeys(['W', 'A', 'S', 'D'], '#ffcc00', '#3224ee', 2000), 2000);
keyboard.animationQueueAdd(() => this.keyboard.animateKeys(['W', 'A', 'S', 'D'], '#3224ee', '#d324ee', 2000), 2000);
keyboard.animationQueueAdd(() => this.keyboard.animateKeys(['W', 'A', 'S', 'D'], '#d324ee', '#55bc18', 2000), 2000);
keyboard.animationQueueStart();

Get Key Pressed event

To get the key press event, you can bind an event to the onData option on initialisation:

//Init Keyboard
keyboard = new RoccatVulcan({
  productId: 12440,
  layout: 'ch-de',
  onData: data => {
    console.log("Key", data.key);
    console.log("State", data.state);
  }
});

The data parameter is an object with two states:

  • key: The key pressed
  • state: The state: 1 = pressed, 0 = released

Turn of a Key

To turn of a key, you need to send the color (#000000) black to the keyboard.

keyboard.fillAll('#000000');

Grid

Sometimes you want to access your key by its position on the keyboard, instead of its value. Use the grid where each key is in a cell.

var grid = keyboard.getGrid();

Returns a multi array. Have a look at the file src/keyboardlayout/ch-de/grid.js

To change the color of the first row (ESC, F1, F2...) use it this way:

var grid = keyboard.getGrid();
keyboard.animateKeys(grid[0], '#000000', '#ff0000', 1000)

Change log

  • 2023-05-22 New Node-Hid-Version. Should run now on most Node-Versions.

Projects made with this library

  • WASD - The Rise of eSports DataViz about eSports: https://github.com/simonhuwiler/dataviz_keyboard
  • FruitSalad, a Game for a keyboard: https://github.com/simonhuwiler/fruitsalad_game
  • Snake Vulcan, the famous game, made for a keyboard: https://github.com/kiarahd/snake-vulcan

Write me to be listed here!