Skip to content

Node.js script for generating animations for kiibohd configurator import

License

Notifications You must be signed in to change notification settings

intafon/kiibohd-animation-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kiibohd-animation-generator

Node.js script for generating animations for kiibohd configurator import

Setup:

This requires node and npm to run. In order to use, cd to the repo directory and run "npm install", and then you can run "node kiianigen.js {generator name} {ktype standard dir}". See documentation in kiianigen.js script for more details on usage. Note that at this time, the arguments are positional, and at least the generator name is required (unless you wish to see the generator names, as detailed below). Also, a directory containing a pre-existing KType-Standard configuration output from the kiibohd configurator is required. Preferably, this directory should be next to the animation generator directory, but if not, the path to the directory can be provided (i.e. "node kiianigen.js {generator name / conf / all} {ktype standard dir if not at ../KType-Standard}" -- see workflow below.)

Usage with kiianiconf.json:

You can now run "node kiianigen.js conf", which will pull in the local file kiianiconf.json and use this as a basis for defining which generators to use in your configuration. If you do not yet have this file in your directory (here), a demo version of kiianiconf.json will be autogenerated when you run "node kiianigen.js conf".

Generators configurable from kiianiconf.json:

  1. kitt2000 -- kitt2000 creates a sweeping color animation (left to right to left) reminiscent of Kitt's grill animation in Knight Rider. (not to be confused with the Cylon eye animation). This is configurable from kiianiconf by providing any of 3 parameters. "params": [[255,0,0], [0,0,0], 5] -- where the first item is a 3 number array representing the animation color, the second item is the 3 number array representing the background color (defaults to black), and the third represents the width of the animating bacd of color (defaults to 5, max is 25)
  2. dodgyPixel -- this simply creates an animation where random pixels light up. There are currently 2 parameters: "params": [[pixel color array], [bg color array]] -- the defaults are [255,255,255] and [25,25,25]
  3. macSleepBreath -- this animation emulates the old macbook sleeping led light that pulsed with the rhythm of a human's breath while sleeping. The current parameters are: "params": [[high color], [low color]] -- where you can basically use any colors here to fade back and forth through. The defaults for this are [255,255,255] and [1,1,1]. (light and dark) The color fades are based on a sine curve.
  4. baseTopBreath -- this is similar to macSleepBreath, except that the colors cycle between the keyboard and the keyboard base leds. Parameters are: "params": [[high color], [low color]] -- the defaults are green and blue.
  5. linearPulse -- exactly like macSleepBreath, except that the algorithm used to generate the color fades is linear, rather than being based on a sine curve.
  6. whiteNoise -- (subject to change soon...) -- this one takes a single parameter which is: "params": [frameCount] -- where frameCount is the number of frames generated. I am thinking of also adding an optional color. Currently this simulates white noise (TV static).
  7. verticalPulseWithTracers -- this one pulses the colors between the top and bottom layer of the keyboard while tracers on the base start at the middle front and wrap right and left around to the back. This takes multiple parameters. "params": [stepsPerColor, ... color arrays] --The first parameter is the number of frames that it takes to transition from one color to the next. The rest of the parameters (any number) specify the 3 item color arrays that should be used. If you specify red, green, and blue color arrays, the top will start with red and animate through the colors, while the bottom will start with green and cycle through the colors.

There are other generators which can be used in the conf file, but they do not currently accept parameters, so they will use whatever parameters are baked in.

Usage with generator names:

Generator names can be found in the "generators" object definition in the kiianigen.js file, or by invoking "node kiianigen.js" with no specified generator. This will print out all available generators.

NOTE: At this point I would not recommend running with "node kiianigen.js all" unless you comment out some of the generators. I've had issues flashing the keyboard with all the current animations, haven't had time to figure out why that is.

Workflow:

  1. Run kiibohd configurator and output the configuration the way you like it (such as swapped keys for mac, etc. etc.)
  2. Move that configurator generated directory next to the directory for kiibohd-animation-generator named "KType-Standard"
  3. Run "node kiianigen.js {generator name} {ktype standard dir if not at ../KType-Standard}"
  4. Find the latest output in the json_out directory, copy contents
  5. Open kiibohd configurator, click the up arrow/import button and paste the contents of the json file into the text box.
  6. Click the down arrow/export button in the configurator
  7. Set the keyboard in flash mode and click the Flash button in the configurator.
  8. Once done, you should be able to press f1:Q, f1:W, f1:E, etc. to toggle the animations.

About

Node.js script for generating animations for kiibohd configurator import

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published