Skip to content

Project Sections

Tom Swirly edited this page Jan 30, 2018 · 1 revision

There are four more project sections that we haven't covered yet:


aliases: a dictionary of aliases, shorthands to avoid repetitive typing

Often, you have a lot of animations coming from the same directory or even the same module. You'd like to avoid a lot of typing - to make reading easier, editing easier too.

Class names are segmented by the . "dot" character. Aliases are segments of a name that start with an @ "at" character.

Example:

"aliases": {
    "bpa": "BiblioPixelAnimations.strip",
    "mine": "myproject.animations.strip"
},

"animation": {
    "typename": "sequence",
    "animations": [
        "@bpa.ColorPattern",
        "@mine.Big",
        {"typename", "@mine.Big.Bigger", "color": "khaki 2"}
   ]
}

gives you three subanimations with types

BiblioPixelAnimations.strip.ColorPattern.ColorPattern
myproject.animations.strip.Big.Big
myproject.animations.strip.Big.Bigger

dimensions: the layout of your LEDs in 1, 2 or 3 dimensions

You can set dimensions in your project file or from the command line as --dimensions= or --dim=. If you set --dim you don't need to set a layout.

It's great if you're experimenting with different configurations of the same animation.

If you have a strip, you can use bp proj.json --dim=100; for a matrix, bp proj.json --dim=160,160; for a cube, bp proj.json --dim=8,8,8;


numbers: whether and how to use fast numpy arithmetic

BiblioPixel was originally written using plain Python but now has the option of using numpy arithmetic for color lists. If you want to use numpy, first install the package:

pip install numpy

(you only ever need to do that once) and then in your project, set

"numbers": "float" 

or from the command line,

bp your-project-name.json -n float  

It doesn't have to be float - we can actually use any sort of numbers you like from this long list and probably get reasonable results, but we're really only testing with float because it hits a lot of sweet spots.


path: a list of directories to add to the PYTHONPATH

The path section is either a list of directories to be added to sys.path, or it's a single string, which is a list of directories joined by :.
These directories are added to your Python sys.path before your project runs.

This is useful if parts of your project are on different parts of your filesystem.

Clone this wiki locally