GlowBit.py
|
A class for animating "pulses" which move down a GlowBit stick. More...
Public Member Functions | |
def | __init__ (self, speed=100, colour=[0xFFFFFF], index=0, colourMap=None) |
Initialisation routine for the GlowBit Stick pulse object. More... | |
Public Member Functions inherited from glowbit.colourFunctions | |
def | wheel (self, pos) |
Converts an integer "colour wheel position" to a packed 32-bit RGB GlowBit colour value. More... | |
def | rgbColour (self, r, g, b) |
Converts the r, g, and b integer arguments to a packed 32-bit RGB GlowBit colour value. More... | |
def | glowbitColour2RGB (self, colour) |
Converts a 32-bit GlowBit colour value to an (R,G,B) tuple. More... | |
def | red (self) |
Returns the GlowBit colour value for pure red. | |
def | green (self) |
Returns the GlowBit colour value for pure green. | |
def | blue (self) |
Returns the GlowBit colour value for pure blue. | |
def | yellow (self) |
Returns the GlowBit colour value for yellow. | |
def | purple (self) |
Returns the GlowBit colour value for purple. | |
def | cyan (self) |
Returns the GlowBit colour value for cyan. | |
def | white (self) |
Returns the GlowBit colour value for white. | |
def | black (self) |
Returns the GlowBit colour value for black. | |
Public Member Functions inherited from glowbit.colourMaps | |
def | colourMapSolid (self, index, minIndex, maxIndex) |
Trivial colourmap method which always returns the colour in the parent object. More... | |
def | colourMapRainbow (self, index, minIndex, maxIndex) |
Maps the pure hue colour wheel between minIndex and maxIndex. More... | |
Public Attributes | |
speed | |
Speed of the pulse. | |
index | |
Initial index of the pulse. | |
colour | |
A list of 32-bit GlowBit colour values. More... | |
colourMap | |
Either the string "Solid" or "Rainbow" or a function pointer to a custom colourmap. More... | |
A class for animating "pulses" which move down a GlowBit stick.
def glowbit.stick.pulse.__init__ | ( | self, | |
speed = 100 , |
|||
colour = [0xFFFFFF] , |
|||
index = 0 , |
|||
colourMap = None |
|||
) |
Initialisation routine for the GlowBit Stick pulse object.
This function uses the pixelSaturatingAdd() method so multiple pulses can be drawn without colour values corrupting due to addition overflow.
speed | The speed of the pulse in units of (pixels moved per frame) * 100. A value of 100 means the pulse will move 1 pixels per frame. A speed of 1 will move a pulse 1 pixel every 100 frames. Speed can be positive or negative to allow pulses to move in either direction. |
colour | A list of 32-bit GlowBit colours for the pulse. The pulse will have a width equal to the number of elements in this list. A list entry of -1 will have the colour set by a colour map function. |
index | The initial index of the pulse. Generally recommended to set to 0 if speed > 0 and numLEDs if speed < 0. |
colourMap | Either the string "Solid" or "Rainbow" or a custom function pointer. Custom functions must take the positional arguments: colourMapFunction(self, index, minIndex, maxIndex). When calling colour map functions updatePulses() sets minIndex to 0 and maxIndex to numLEDs. |
glowbit.stick.pulse.colour |
A list of 32-bit GlowBit colour values.
Each one is drawn to a pixel; a -1 indicates the use of the colourMap function
glowbit.stick.pulse.colourMap |
Either the string "Solid" or "Rainbow" or a function pointer to a custom colourmap.
Only sets pixel colour for pixels with a colour of -1.