ported changes from non-chained version of example.
Tested with 128x128 pane (four 64x64 panels) Signed-off-by: Emil Muratov <gpm@hotplug.ru>
This commit is contained in:
parent
445c0424f4
commit
33b95f534f
27 changed files with 1772 additions and 945 deletions
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
Attractor() {
|
Attractor() {
|
||||||
location = PVector(MATRIX_CENTRE_X, MATRIX_CENTRE_Y);
|
location = PVector(MATRIX_CENTRE_X, MATRIX_CENTRE_Y);
|
||||||
mass = 8;
|
mass = 10;
|
||||||
G = .5;
|
G = .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,14 +125,15 @@ void setup()
|
||||||
void patternAdvance(){
|
void patternAdvance(){
|
||||||
// Go to next pattern in the list (se Patterns.h)
|
// Go to next pattern in the list (se Patterns.h)
|
||||||
patterns.stop();
|
patterns.stop();
|
||||||
patterns.move(1);
|
patterns.moveRandom(1);
|
||||||
|
//patterns.move(1);
|
||||||
patterns.start();
|
patterns.start();
|
||||||
// Select a random palette as well
|
// Select a random palette as well
|
||||||
effects.RandomPalette();
|
effects.RandomPalette();
|
||||||
Serial.print("Changing pattern to: ");
|
Serial.print("Changing pattern to: ");
|
||||||
Serial.println(patterns.getCurrentPatternName());
|
Serial.println(patterns.getCurrentPatternName());
|
||||||
Serial.println(patterns.getPatternIndex());
|
//Serial.println(patterns.getPatternIndex());
|
||||||
lastPattern = patterns.getPatternIndex();
|
//lastPattern = patterns.getPatternIndex();
|
||||||
// Save last index.
|
// Save last index.
|
||||||
preferences.begin("RGBMATRIX", false);
|
preferences.begin("RGBMATRIX", false);
|
||||||
preferences.putInt("lastPattern", lastPattern);
|
preferences.putInt("lastPattern", lastPattern);
|
||||||
|
|
|
@ -43,6 +43,11 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual void printTesting()
|
||||||
|
{
|
||||||
|
Serial.println("Testing...");
|
||||||
|
}
|
||||||
|
|
||||||
virtual void start() {};
|
virtual void start() {};
|
||||||
virtual void stop() {};
|
virtual void stop() {};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Aurora: https://github.com/pixelmatix/aurora
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
Copyright (c) 2014 Jason Coon
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
Portions of this code are adapted from "Funky Clouds" by Stefan Petrick: https://gist.github.com/anonymous/876f908333cd95315c35
|
* Portions of this code are adapted from "Funky Clouds" by Stefan Petrick: https://gist.github.com/anonymous/876f908333cd95315c35
|
||||||
Portions of this code are adapted from "NoiseSmearing" by Stefan Petrick: https://gist.github.com/StefanPetrick/9ee2f677dbff64e3ba7a
|
* Portions of this code are adapted from "NoiseSmearing" by Stefan Petrick: https://gist.github.com/StefanPetrick/9ee2f677dbff64e3ba7a
|
||||||
Copyright (c) 2014 Stefan Petrick
|
* Copyright (c) 2014 Stefan Petrick
|
||||||
http://www.stefan-petrick.de/wordpress_beta
|
* http://www.stefan-petrick.de/wordpress_beta
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
* the Software without restriction, including without limitation the rights to
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
subject to the following conditions:
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in all
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef Effects_H
|
#ifndef Effects_H
|
||||||
|
@ -31,32 +31,45 @@
|
||||||
|
|
||||||
/* ---------------------------- GLOBAL CONSTANTS ----------------------------- */
|
/* ---------------------------- GLOBAL CONSTANTS ----------------------------- */
|
||||||
|
|
||||||
//const int MATRIX_CENTER_X = MATRIX_WIDTH / 2;
|
|
||||||
//const int MATRIX_CENTER_Y = MATRIX_HEIGHT / 2;
|
|
||||||
//const byte MATRIX_CENTRE_X = MATRIX_CENTER_X - 1;
|
|
||||||
//const byte MATRIX_CENTRE_Y = MATRIX_CENTER_Y - 1;
|
|
||||||
|
|
||||||
const int MATRIX_CENTER_X = VPANEL_W / 2;
|
const int MATRIX_CENTER_X = VPANEL_W / 2;
|
||||||
const int MATRIX_CENTER_Y = VPANEL_H / 2;
|
const int MATRIX_CENTER_Y = VPANEL_H / 2;
|
||||||
const byte MATRIX_CENTRE_X = MATRIX_CENTER_X - 1;
|
// US vs GB, huh? :)
|
||||||
const byte MATRIX_CENTRE_Y = MATRIX_CENTER_Y - 1;
|
//const byte MATRIX_CENTRE_X = MATRIX_CENTER_X - 1;
|
||||||
|
//const byte MATRIX_CENTRE_Y = MATRIX_CENTER_Y - 1;
|
||||||
|
#define MATRIX_CENTRE_X MATRIX_CENTER_X
|
||||||
|
#define MATRIX_CENTRE_Y MATRIX_CENTER_Y
|
||||||
|
|
||||||
|
|
||||||
const uint16_t NUM_LEDS = (VPANEL_W * VPANEL_H) + 1; // one led spare to capture out of bounds
|
const uint16_t NUM_LEDS = (VPANEL_W * VPANEL_H) + 1; // one led spare to capture out of bounds
|
||||||
|
|
||||||
|
// forward declaration
|
||||||
|
uint16_t XY16( uint16_t x, uint16_t y);
|
||||||
|
|
||||||
/* Convert x,y co-ordinate to flat array index.
|
/* Convert x,y co-ordinate to flat array index.
|
||||||
x and y positions start from 0, so must not be >= 'real' panel width or height
|
* x and y positions start from 0, so must not be >= 'real' panel width or height
|
||||||
(i.e. 64 pixels or 32 pixels.). Max value: MATRIX_WIDTH-1 etc.
|
* (i.e. 64 pixels or 32 pixels.). Max value: VPANEL_W-1 etc.
|
||||||
|
* Ugh... uint8_t - really??? this weak method can't cope with 256+ pixel matrixes :(
|
||||||
*/
|
*/
|
||||||
uint16_t XY( uint8_t x, uint8_t y)
|
uint16_t XY( uint8_t x, uint8_t y)
|
||||||
{
|
{
|
||||||
if ( x >= VPANEL_W || x < 0) return 0;
|
return XY16(x, y);
|
||||||
if ( y >= VPANEL_H || y < 0) return 0;
|
|
||||||
|
|
||||||
return (y * VPANEL_W) + x + 1; // everything offset by one to capture out of bounds stuff - never displayed by ShowFrame()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some mathematics provided by FastLED
|
/**
|
||||||
|
* The one for 256+ matrixes
|
||||||
|
* otherwise this:
|
||||||
|
* for (uint8_t i = 0; i < VPANEL_W; i++) {}
|
||||||
|
* turns into an infinite loop
|
||||||
|
*/
|
||||||
|
uint16_t XY16( uint16_t x, uint16_t y)
|
||||||
|
{
|
||||||
|
if( x >= VPANEL_W) return 0;
|
||||||
|
if( y >= VPANEL_H) return 0;
|
||||||
|
|
||||||
|
return (y * VPANEL_W) + x + 1; // everything offset by one to capute out of bounds stuff - never displayed by ShowFrame()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t beatcos8(accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest = 255, uint32_t timebase = 0, uint8_t phase_offset = 0)
|
uint8_t beatcos8(accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest = 255, uint32_t timebase = 0, uint8_t phase_offset = 0)
|
||||||
{
|
{
|
||||||
uint8_t beat = beat8(beats_per_minute, timebase);
|
uint8_t beat = beat8(beats_per_minute, timebase);
|
||||||
|
@ -84,7 +97,7 @@ uint8_t mapcos8(uint8_t theta, uint8_t lowest = 0, uint8_t highest = 255) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array of temperature readings at each simulation cell
|
// Array of temperature readings at each simulation cell
|
||||||
byte heat[NUM_LEDS];
|
//byte heat[NUM_LEDS]; // none of the currently enabled effects uses this
|
||||||
|
|
||||||
uint32_t noise_x;
|
uint32_t noise_x;
|
||||||
uint32_t noise_y;
|
uint32_t noise_y;
|
||||||
|
@ -92,34 +105,55 @@ uint32_t noise_z;
|
||||||
uint32_t noise_scale_x;
|
uint32_t noise_scale_x;
|
||||||
uint32_t noise_scale_y;
|
uint32_t noise_scale_y;
|
||||||
|
|
||||||
uint8_t noise[VPANEL_W][VPANEL_H];
|
//uint8_t noise[VPANEL_W][VPANEL_H];
|
||||||
|
uint8_t **noise = nullptr; // we will allocate mem later
|
||||||
uint8_t noisesmoothing;
|
uint8_t noisesmoothing;
|
||||||
|
|
||||||
class Effects {
|
class Effects {
|
||||||
public:
|
public:
|
||||||
//CRGB *leds;
|
CRGB *leds;
|
||||||
CRGB leds[NUM_LEDS];
|
//CRGB leds[NUM_LEDS];
|
||||||
CRGB leds2[NUM_LEDS]; // Faptastic: getting rid of this and any dependant effects or algos. to save memory 24*64*32 bytes of ram (50k).
|
//CRGB leds2[NUM_LEDS]; // Faptastic: getting rid of this and any dependant effects or algos. to save memory 24*64*32 bytes of ram (50k).
|
||||||
|
|
||||||
|
Effects(){
|
||||||
|
// we do dynamic allocation for leds buffer, otherwise esp32 toolchain can't link static arrays of such a big size for 256+ matrixes
|
||||||
|
leds = (CRGB *)malloc(NUM_LEDS * sizeof(CRGB));
|
||||||
|
|
||||||
|
// allocate mem for noise effect
|
||||||
|
// (there should be some guards for malloc errors eventually)
|
||||||
|
noise = (uint8_t **)malloc(VPANEL_W * sizeof(uint8_t *));
|
||||||
|
for (int i = 0; i < VPANEL_W; ++i) {
|
||||||
|
noise[i] = (uint8_t *)malloc(VPANEL_H * sizeof(uint8_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearFrame();
|
||||||
|
matrix.clearScreen();
|
||||||
|
}
|
||||||
|
~Effects(){
|
||||||
|
free(leds);
|
||||||
|
for (int i = 0; i < VPANEL_W; ++i) {
|
||||||
|
free(noise[i]);
|
||||||
|
}
|
||||||
|
free(noise);
|
||||||
|
}
|
||||||
|
|
||||||
/* The only 'framebuffer' we have is what is contained in the leds and leds2 variables.
|
/* The only 'framebuffer' we have is what is contained in the leds and leds2 variables.
|
||||||
We don't store what the color a particular pixel might be, other than when it's turned
|
* We don't store what the color a particular pixel might be, other than when it's turned
|
||||||
into raw electrical signal output gobbly-gook (i.e. the DMA matrix buffer), but this * is not reversible.
|
* into raw electrical signal output gobbly-gook (i.e. the DMA matrix buffer), but this * is not reversible.
|
||||||
|
*
|
||||||
As such, any time these effects want to write a pixel color, we first have to update
|
* As such, any time these effects want to write a pixel color, we first have to update
|
||||||
the leds or leds2 array, and THEN write it to the RGB panel. This enables us to 'look up' the array to see what a pixel color was previously, each drawFrame().
|
* the leds or leds2 array, and THEN write it to the RGB panel. This enables us to 'look up' the array to see what a pixel color was previously, each drawFrame().
|
||||||
*/
|
*/
|
||||||
void drawBackgroundFastLEDPixelCRGB(int16_t x, int16_t y, CRGB color)
|
void drawBackgroundFastLEDPixelCRGB(int16_t x, int16_t y, CRGB color)
|
||||||
{
|
{
|
||||||
leds[XY(x, y)] = color;
|
leds[XY(x, y)] = color;
|
||||||
virtualDisp.drawPixelRGB888(x, y, color.r, color.g, color.b);
|
//matrix.drawPixelRGB888(x, y, color.r, color.g, color.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write one pixel with the specified color from the current palette to coordinates
|
// write one pixel with the specified color from the current palette to coordinates
|
||||||
void Pixel(int x, int y, uint8_t colorIndex) {
|
void Pixel(int x, int y, uint8_t colorIndex) {
|
||||||
CRGB temp = ColorFromCurrentPalette(colorIndex);
|
leds[XY(x, y)] = ColorFromCurrentPalette(colorIndex);
|
||||||
leds[XY(x, y)] = temp;
|
//matrix.drawPixelRGB888(x, y, temp.r, temp.g, temp.b); // now draw it?
|
||||||
virtualDisp.drawPixelRGB888(x, y, temp.r, temp.g, temp.b); // now draw it?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareFrame() {
|
void PrepareFrame() {
|
||||||
|
@ -127,24 +161,25 @@ class Effects {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowFrame() {
|
void ShowFrame() {
|
||||||
#if (FASTLED_VERSION >= 3001000)
|
//#if (FASTLED_VERSION >= 3001000)
|
||||||
nblendPaletteTowardPalette(currentPalette, targetPalette, 24);
|
// nblendPaletteTowardPalette(currentPalette, targetPalette, 24);
|
||||||
#else
|
//#else
|
||||||
currentPalette = targetPalette;
|
currentPalette = targetPalette;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// backgroundLayer.swapBuffers();
|
// backgroundLayer.swapBuffers();
|
||||||
// leds = (CRGB*) backgroundLayer.backBuffer();
|
// leds = (CRGB*) backgroundLayer.backBuffer();
|
||||||
// LEDS.countFPS();
|
// LEDS.countFPS();
|
||||||
for (int y = 0; y < VPANEL_H; y++) {
|
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int y=0; y<VPANEL_H; ++y){
|
||||||
{
|
for (int x=0; x<VPANEL_W; ++x){
|
||||||
CRGB tmp_led = leds[XY(x, y)];
|
//Serial.printf("Flushing x, y coord %d, %d\n", x, y);
|
||||||
virtualDisp.drawPixelRGB888( x, y, tmp_led.r, tmp_led.g, tmp_led.b);
|
uint16_t _pixel = XY16(x,y);
|
||||||
|
virtualDisp.drawPixelRGB888( x, y, leds[_pixel].r, leds[_pixel].g, leds[_pixel].b);
|
||||||
} // end loop to copy fast led to the dma matrix
|
} // end loop to copy fast led to the dma matrix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// scale the brightness of the screenbuffer down
|
// scale the brightness of the screenbuffer down
|
||||||
void DimAll(byte value)
|
void DimAll(byte value)
|
||||||
{
|
{
|
||||||
|
@ -156,12 +191,12 @@ class Effects {
|
||||||
|
|
||||||
void ClearFrame()
|
void ClearFrame()
|
||||||
{
|
{
|
||||||
memset(leds, 0x00, sizeof(leds)); // flush
|
memset(leds, 0x00, NUM_LEDS * sizeof(CRGB)); // flush
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
void CircleStream(uint8_t value) {
|
void CircleStream(uint8_t value) {
|
||||||
DimAll(value); ShowFrame();
|
DimAll(value); ShowFrame();
|
||||||
|
|
||||||
|
@ -193,7 +228,7 @@ class Effects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// palettes
|
// palettes
|
||||||
static const int paletteCount = 10;
|
static const int paletteCount = 10;
|
||||||
|
@ -233,6 +268,10 @@ class Effects {
|
||||||
targetPalette = RainbowColors_p;
|
targetPalette = RainbowColors_p;
|
||||||
currentPaletteName = (char *)"Rainbow";
|
currentPaletteName = (char *)"Rainbow";
|
||||||
break;
|
break;
|
||||||
|
//case 1:
|
||||||
|
// targetPalette = RainbowStripeColors_p;
|
||||||
|
// currentPaletteName = (char *)"RainbowStripe";
|
||||||
|
// break;
|
||||||
case 1:
|
case 1:
|
||||||
targetPalette = OceanColors_p;
|
targetPalette = OceanColors_p;
|
||||||
currentPaletteName = (char *)"Ocean";
|
currentPaletteName = (char *)"Ocean";
|
||||||
|
@ -276,6 +315,8 @@ class Effects {
|
||||||
void setPalette(String paletteName) {
|
void setPalette(String paletteName) {
|
||||||
if (paletteName == "Rainbow")
|
if (paletteName == "Rainbow")
|
||||||
loadPalette(0);
|
loadPalette(0);
|
||||||
|
//else if (paletteName == "RainbowStripe")
|
||||||
|
// loadPalette(1);
|
||||||
else if (paletteName == "Ocean")
|
else if (paletteName == "Ocean")
|
||||||
loadPalette(1);
|
loadPalette(1);
|
||||||
else if (paletteName == "Cloud")
|
else if (paletteName == "Cloud")
|
||||||
|
@ -343,7 +384,7 @@ class Effects {
|
||||||
// the oscillators: linear ramps 0-255
|
// the oscillators: linear ramps 0-255
|
||||||
byte osci[6];
|
byte osci[6];
|
||||||
|
|
||||||
// sin8(osci) swinging between 0 to MATRIX_WIDTH - 1
|
// sin8(osci) swinging between 0 to VPANEL_W - 1
|
||||||
byte p[6];
|
byte p[6];
|
||||||
|
|
||||||
// set the speeds (and by that ratios) of the oscillators here
|
// set the speeds (and by that ratios) of the oscillators here
|
||||||
|
@ -356,7 +397,7 @@ class Effects {
|
||||||
if (osci[4] % 2 == 0)
|
if (osci[4] % 2 == 0)
|
||||||
osci[5] = osci[5] + 1; // .5
|
osci[5] = osci[5] + 1; // .5
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
p[i] = map8(sin8(osci[i]), 0, VPANEL_W - 1); //why? to keep the result in the range of 0-MATRIX_WIDTH (matrix size)
|
p[i] = map8(sin8(osci[i]), 0, VPANEL_W - 1); //why? to keep the result in the range of 0-VPANEL_W (matrix size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,9 +409,9 @@ class Effects {
|
||||||
void Caleidoscope1() {
|
void Caleidoscope1() {
|
||||||
for (int x = 0; x < MATRIX_CENTER_X; x++) {
|
for (int x = 0; x < MATRIX_CENTER_X; x++) {
|
||||||
for (int y = 0; y < MATRIX_CENTER_Y; y++) {
|
for (int y = 0; y < MATRIX_CENTER_Y; y++) {
|
||||||
leds[XY(VPANEL_W - 1 - x, y)] = leds[XY(x, y)];
|
leds[XY16(VPANEL_W - 1 - x, y)] = leds[XY16(x, y)];
|
||||||
leds[XY(VPANEL_W - 1 - x, VPANEL_H - 1 - y)] = leds[XY(x, y)];
|
leds[XY16(VPANEL_W - 1 - x, VPANEL_H - 1 - y)] = leds[XY16(x, y)];
|
||||||
leds[XY(x, VPANEL_H - 1 - y)] = leds[XY(x, y)];
|
leds[XY16(x, VPANEL_H - 1 - y)] = leds[XY16(x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,18 +421,18 @@ class Effects {
|
||||||
void Caleidoscope2() {
|
void Caleidoscope2() {
|
||||||
for (int x = 0; x < MATRIX_CENTER_X; x++) {
|
for (int x = 0; x < MATRIX_CENTER_X; x++) {
|
||||||
for (int y = 0; y < MATRIX_CENTER_Y; y++) {
|
for (int y = 0; y < MATRIX_CENTER_Y; y++) {
|
||||||
leds[XY(VPANEL_W - 1 - x, y)] = leds[XY(y, x)];
|
leds[XY16(VPANEL_W - 1 - x, y)] = leds[XY16(y, x)];
|
||||||
leds[XY(x, VPANEL_H - 1 - y)] = leds[XY(y, x)];
|
leds[XY16(x, VPANEL_H - 1 - y)] = leds[XY16(y, x)];
|
||||||
leds[XY(VPANEL_W - 1 - x, VPANEL_H - 1 - y)] = leds[XY(x, y)];
|
leds[XY16(VPANEL_W - 1 - x, VPANEL_H - 1 - y)] = leds[XY16(x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy one diagonal triangle into the other one within a 16x16
|
// copy one diagonal triangle into the other one within a 16x16
|
||||||
void Caleidoscope3() {
|
void Caleidoscope3() {
|
||||||
for (int x = 0; x <= MATRIX_CENTRE_X; x++) {
|
for (int x = 0; x <= MATRIX_CENTRE_X && x < VPANEL_H; x++) {
|
||||||
for (int y = 0; y <= x; y++) {
|
for (int y = 0; y <= x && y<VPANEL_H; y++) {
|
||||||
leds[XY(x, y)] = leds[XY(y, x)];
|
leds[XY16(x, y)] = leds[XY16(y, x)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,7 +441,7 @@ class Effects {
|
||||||
void Caleidoscope4() {
|
void Caleidoscope4() {
|
||||||
for (int x = 0; x <= MATRIX_CENTRE_X; x++) {
|
for (int x = 0; x <= MATRIX_CENTRE_X; x++) {
|
||||||
for (int y = 0; y <= MATRIX_CENTRE_Y - x; y++) {
|
for (int y = 0; y <= MATRIX_CENTRE_Y - x; y++) {
|
||||||
leds[XY(MATRIX_CENTRE_Y - y, MATRIX_CENTRE_X - x)] = leds[XY(x, y)];
|
leds[XY16(MATRIX_CENTRE_Y - y, MATRIX_CENTRE_X - x)] = leds[XY16(x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,39 +449,39 @@ class Effects {
|
||||||
// copy one diagonal triangle into the other one within a 8x8
|
// copy one diagonal triangle into the other one within a 8x8
|
||||||
void Caleidoscope5() {
|
void Caleidoscope5() {
|
||||||
for (int x = 0; x < VPANEL_W / 4; x++) {
|
for (int x = 0; x < VPANEL_W / 4; x++) {
|
||||||
for (int y = 0; y <= x; y++) {
|
for (int y = 0; y <= x && y<=VPANEL_H; y++) {
|
||||||
leds[XY(x, y)] = leds[XY(y, x)];
|
leds[XY16(x, y)] = leds[XY16(y, x)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = VPANEL_W / 4; x < VPANEL_W / 2; x++) {
|
for (int x = VPANEL_W / 4; x < VPANEL_W / 2; x++) {
|
||||||
for (int y = VPANEL_H / 4; y >= 0; y--) {
|
for (int y = VPANEL_H / 4; y >= 0; y--) {
|
||||||
leds[XY(x, y)] = leds[XY(y, x)];
|
leds[XY16(x, y)] = leds[XY16(y, x)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Caleidoscope6() {
|
void Caleidoscope6() {
|
||||||
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 7)] = leds[XY(x, 0)];
|
leds[XY16(7 - x, 7)] = leds[XY16(x, 0)];
|
||||||
} //a
|
} //a
|
||||||
for (int x = 2; x < MATRIX_CENTER_X; x++) {
|
for (int x = 2; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 6)] = leds[XY(x, 1)];
|
leds[XY16(7 - x, 6)] = leds[XY16(x, 1)];
|
||||||
} //b
|
} //b
|
||||||
for (int x = 3; x < MATRIX_CENTER_X; x++) {
|
for (int x = 3; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 5)] = leds[XY(x, 2)];
|
leds[XY16(7 - x, 5)] = leds[XY16(x, 2)];
|
||||||
} //c
|
} //c
|
||||||
for (int x = 4; x < MATRIX_CENTER_X; x++) {
|
for (int x = 4; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 4)] = leds[XY(x, 3)];
|
leds[XY16(7 - x, 4)] = leds[XY16(x, 3)];
|
||||||
} //d
|
} //d
|
||||||
for (int x = 5; x < MATRIX_CENTER_X; x++) {
|
for (int x = 5; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 3)] = leds[XY(x, 4)];
|
leds[XY16(7 - x, 3)] = leds[XY16(x, 4)];
|
||||||
} //e
|
} //e
|
||||||
for (int x = 6; x < MATRIX_CENTER_X; x++) {
|
for (int x = 6; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 2)] = leds[XY(x, 5)];
|
leds[XY16(7 - x, 2)] = leds[XY16(x, 5)];
|
||||||
} //f
|
} //f
|
||||||
for (int x = 7; x < MATRIX_CENTER_X; x++) {
|
for (int x = 7; x < MATRIX_CENTER_X; x++) {
|
||||||
leds[XY(7 - x, 1)] = leds[XY(x, 6)];
|
leds[XY16(7 - x, 1)] = leds[XY16(x, 6)];
|
||||||
} //g
|
} //g
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,20 +490,20 @@ class Effects {
|
||||||
void SpiralStream(int x, int y, int r, byte dimm) {
|
void SpiralStream(int x, int y, int r, byte dimm) {
|
||||||
for (int d = r; d >= 0; d--) { // from the outside to the inside
|
for (int d = r; d >= 0; d--) { // from the outside to the inside
|
||||||
for (int i = x - d; i <= x + d; i++) {
|
for (int i = x - d; i <= x + d; i++) {
|
||||||
leds[XY(i, y - d)] += leds[XY(i + 1, y - d)]; // lowest row to the right
|
leds[XY16(i, y - d)] += leds[XY16(i + 1, y - d)]; // lowest row to the right
|
||||||
leds[XY(i, y - d)].nscale8(dimm);
|
leds[XY16(i, y - d)].nscale8(dimm);
|
||||||
}
|
}
|
||||||
for (int i = y - d; i <= y + d; i++) {
|
for (int i = y - d; i <= y + d; i++) {
|
||||||
leds[XY(x + d, i)] += leds[XY(x + d, i + 1)]; // right colum up
|
leds[XY16(x + d, i)] += leds[XY16(x + d, i + 1)]; // right colum up
|
||||||
leds[XY(x + d, i)].nscale8(dimm);
|
leds[XY16(x + d, i)].nscale8(dimm);
|
||||||
}
|
}
|
||||||
for (int i = x + d; i >= x - d; i--) {
|
for (int i = x + d; i >= x - d; i--) {
|
||||||
leds[XY(i, y + d)] += leds[XY(i - 1, y + d)]; // upper row to the left
|
leds[XY16(i, y + d)] += leds[XY16(i - 1, y + d)]; // upper row to the left
|
||||||
leds[XY(i, y + d)].nscale8(dimm);
|
leds[XY16(i, y + d)].nscale8(dimm);
|
||||||
}
|
}
|
||||||
for (int i = y + d; i >= y - d; i--) {
|
for (int i = y + d; i >= y - d; i--) {
|
||||||
leds[XY(x - d, i)] += leds[XY(x - d, i - 1)]; // left colum down
|
leds[XY16(x - d, i)] += leds[XY16(x - d, i - 1)]; // left colum down
|
||||||
leds[XY(x - d, i)].nscale8(dimm);
|
leds[XY16(x - d, i)].nscale8(dimm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,24 +526,24 @@ class Effects {
|
||||||
while (a >= b)
|
while (a >= b)
|
||||||
{
|
{
|
||||||
// move them out one pixel on the radius
|
// move them out one pixel on the radius
|
||||||
leds[XY(a + centerX, b + centerY)] = leds[XY(nextA + centerX, nextB + centerY)];
|
leds[XY16(a + centerX, b + centerY)] = leds[XY16(nextA + centerX, nextB + centerY)];
|
||||||
leds[XY(b + centerX, a + centerY)] = leds[XY(nextB + centerX, nextA + centerY)];
|
leds[XY16(b + centerX, a + centerY)] = leds[XY16(nextB + centerX, nextA + centerY)];
|
||||||
leds[XY(-a + centerX, b + centerY)] = leds[XY(-nextA + centerX, nextB + centerY)];
|
leds[XY16(-a + centerX, b + centerY)] = leds[XY16(-nextA + centerX, nextB + centerY)];
|
||||||
leds[XY(-b + centerX, a + centerY)] = leds[XY(-nextB + centerX, nextA + centerY)];
|
leds[XY16(-b + centerX, a + centerY)] = leds[XY16(-nextB + centerX, nextA + centerY)];
|
||||||
leds[XY(-a + centerX, -b + centerY)] = leds[XY(-nextA + centerX, -nextB + centerY)];
|
leds[XY16(-a + centerX, -b + centerY)] = leds[XY16(-nextA + centerX, -nextB + centerY)];
|
||||||
leds[XY(-b + centerX, -a + centerY)] = leds[XY(-nextB + centerX, -nextA + centerY)];
|
leds[XY16(-b + centerX, -a + centerY)] = leds[XY16(-nextB + centerX, -nextA + centerY)];
|
||||||
leds[XY(a + centerX, -b + centerY)] = leds[XY(nextA + centerX, -nextB + centerY)];
|
leds[XY16(a + centerX, -b + centerY)] = leds[XY16(nextA + centerX, -nextB + centerY)];
|
||||||
leds[XY(b + centerX, -a + centerY)] = leds[XY(nextB + centerX, -nextA + centerY)];
|
leds[XY16(b + centerX, -a + centerY)] = leds[XY16(nextB + centerX, -nextA + centerY)];
|
||||||
|
|
||||||
// dim them
|
// dim them
|
||||||
leds[XY(a + centerX, b + centerY)].nscale8(dimm);
|
leds[XY16(a + centerX, b + centerY)].nscale8(dimm);
|
||||||
leds[XY(b + centerX, a + centerY)].nscale8(dimm);
|
leds[XY16(b + centerX, a + centerY)].nscale8(dimm);
|
||||||
leds[XY(-a + centerX, b + centerY)].nscale8(dimm);
|
leds[XY16(-a + centerX, b + centerY)].nscale8(dimm);
|
||||||
leds[XY(-b + centerX, a + centerY)].nscale8(dimm);
|
leds[XY16(-b + centerX, a + centerY)].nscale8(dimm);
|
||||||
leds[XY(-a + centerX, -b + centerY)].nscale8(dimm);
|
leds[XY16(-a + centerX, -b + centerY)].nscale8(dimm);
|
||||||
leds[XY(-b + centerX, -a + centerY)].nscale8(dimm);
|
leds[XY16(-b + centerX, -a + centerY)].nscale8(dimm);
|
||||||
leds[XY(a + centerX, -b + centerY)].nscale8(dimm);
|
leds[XY16(a + centerX, -b + centerY)].nscale8(dimm);
|
||||||
leds[XY(b + centerX, -a + centerY)].nscale8(dimm);
|
leds[XY16(b + centerX, -a + centerY)].nscale8(dimm);
|
||||||
|
|
||||||
b++;
|
b++;
|
||||||
if (radiusError < 0)
|
if (radiusError < 0)
|
||||||
|
@ -532,12 +573,12 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = fromX + 1; x < toX; x++) {
|
for (int x = fromX + 1; x < toX; x++) {
|
||||||
for (int y = fromY; y < toY; y++) {
|
for (int y = fromY; y < toY; y++) {
|
||||||
leds[XY(x, y)] += leds[XY(x - 1, y)];
|
leds[XY16(x, y)] += leds[XY16(x - 1, y)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int y = fromY; y < toY; y++)
|
for (int y = fromY; y < toY; y++)
|
||||||
leds[XY(0, y)].nscale8(scale);
|
leds[XY16(0, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// give it a linear tail to the left
|
// give it a linear tail to the left
|
||||||
|
@ -545,12 +586,12 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = toX; x < fromX; x++) {
|
for (int x = toX; x < fromX; x++) {
|
||||||
for (int y = fromY; y < toY; y++) {
|
for (int y = fromY; y < toY; y++) {
|
||||||
leds[XY(x, y)] += leds[XY(x + 1, y)];
|
leds[XY16(x, y)] += leds[XY16(x + 1, y)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int y = fromY; y < toY; y++)
|
for (int y = fromY; y < toY; y++)
|
||||||
leds[XY(0, y)].nscale8(scale);
|
leds[XY16(0, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// give it a linear tail downwards
|
// give it a linear tail downwards
|
||||||
|
@ -558,12 +599,12 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = 0; x < VPANEL_W; x++) {
|
for (int x = 0; x < VPANEL_W; x++) {
|
||||||
for (int y = 1; y < VPANEL_H; y++) {
|
for (int y = 1; y < VPANEL_H; y++) {
|
||||||
leds[XY(x, y)] += leds[XY(x, y - 1)];
|
leds[XY16(x, y)] += leds[XY16(x, y - 1)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; x++)
|
||||||
leds[XY(x, 0)].nscale8(scale);
|
leds[XY16(x, 0)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// give it a linear tail upwards
|
// give it a linear tail upwards
|
||||||
|
@ -571,12 +612,12 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = 0; x < VPANEL_W; x++) {
|
for (int x = 0; x < VPANEL_W; x++) {
|
||||||
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
||||||
leds[XY(x, y)] += leds[XY(x, y + 1)];
|
leds[XY16(x, y)] += leds[XY16(x, y + 1)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; x++)
|
||||||
leds[XY(x, VPANEL_H - 1)].nscale8(scale);
|
leds[XY16(x, VPANEL_H - 1)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// give it a linear tail up and to the left
|
// give it a linear tail up and to the left
|
||||||
|
@ -584,14 +625,14 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = 0; x < VPANEL_W - 1; x++) {
|
for (int x = 0; x < VPANEL_W - 1; x++) {
|
||||||
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
||||||
leds[XY(x, y)] += leds[XY(x + 1, y + 1)];
|
leds[XY16(x, y)] += leds[XY16(x + 1, y + 1)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; x++)
|
||||||
leds[XY(x, VPANEL_H - 1)].nscale8(scale);
|
leds[XY16(x, VPANEL_H - 1)].nscale8(scale);
|
||||||
for (int y = 0; y < VPANEL_H; y++)
|
for (int y = 0; y < VPANEL_H; y++)
|
||||||
leds[XY(VPANEL_W - 1, y)].nscale8(scale);
|
leds[XY16(VPANEL_W - 1, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// give it a linear tail up and to the right
|
// give it a linear tail up and to the right
|
||||||
|
@ -599,24 +640,24 @@ class Effects {
|
||||||
{
|
{
|
||||||
for (int x = 0; x < VPANEL_W - 1; x++) {
|
for (int x = 0; x < VPANEL_W - 1; x++) {
|
||||||
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
for (int y = VPANEL_H - 2; y >= 0; y--) {
|
||||||
leds[XY(x + 1, y)] += leds[XY(x, y + 1)];
|
leds[XY16(x + 1, y)] += leds[XY16(x, y + 1)];
|
||||||
leds[XY(x, y)].nscale8(scale);
|
leds[XY16(x, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fade the bottom row
|
// fade the bottom row
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; x++)
|
||||||
leds[XY(x, VPANEL_H - 1)].nscale8(scale);
|
leds[XY16(x, VPANEL_H - 1)].nscale8(scale);
|
||||||
|
|
||||||
// fade the right column
|
// fade the right column
|
||||||
for (int y = 0; y < VPANEL_H; y++)
|
for (int y = 0; y < VPANEL_H; y++)
|
||||||
leds[XY(VPANEL_W - 1, y)].nscale8(scale);
|
leds[XY16(VPANEL_W - 1, y)].nscale8(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// just move everything one line down
|
// just move everything one line down
|
||||||
void MoveDown() {
|
void MoveDown() {
|
||||||
for (int y = VPANEL_H - 1; y > 0; y--) {
|
for (int y = VPANEL_H - 1; y > 0; y--) {
|
||||||
for (int x = 0; x < VPANEL_W; x++) {
|
for (int x = 0; x < VPANEL_W; x++) {
|
||||||
leds[XY(x, y)] = leds[XY(x, y - 1)];
|
leds[XY16(x, y)] = leds[XY16(x, y - 1)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +666,7 @@ class Effects {
|
||||||
void VerticalMoveFrom(int start, int end) {
|
void VerticalMoveFrom(int start, int end) {
|
||||||
for (int y = end; y > start; y--) {
|
for (int y = end; y > start; y--) {
|
||||||
for (int x = 0; x < VPANEL_W; x++) {
|
for (int x = 0; x < VPANEL_W; x++) {
|
||||||
leds[XY(x, y)] = leds[XY(x, y - 1)];
|
leds[XY16(x, y)] = leds[XY16(x, y - 1)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +676,7 @@ class Effects {
|
||||||
void Copy(byte x0, byte y0, byte x1, byte y1, byte x2, byte y2) {
|
void Copy(byte x0, byte y0, byte x1, byte y1, byte x2, byte y2) {
|
||||||
for (int y = y0; y < y1 + 1; y++) {
|
for (int y = y0; y < y1 + 1; y++) {
|
||||||
for (int x = x0; x < x1 + 1; x++) {
|
for (int x = x0; x < x1 + 1; x++) {
|
||||||
leds[XY(x + x2 - x0, y + y2 - y0)] = leds[XY(x, y)];
|
leds[XY16(x + x2 - x0, y + y2 - y0)] = leds[XY16(x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,7 +685,7 @@ class Effects {
|
||||||
void RotateTriangle() {
|
void RotateTriangle() {
|
||||||
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
||||||
for (int y = 0; y < x; y++) {
|
for (int y = 0; y < x; y++) {
|
||||||
leds[XY(x, 7 - y)] = leds[XY(7 - x, y)];
|
leds[XY16(x, 7 - y)] = leds[XY16(7 - x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +694,7 @@ class Effects {
|
||||||
void MirrorTriangle() {
|
void MirrorTriangle() {
|
||||||
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
for (int x = 1; x < MATRIX_CENTER_X; x++) {
|
||||||
for (int y = 0; y < x; y++) {
|
for (int y = 0; y < x; y++) {
|
||||||
leds[XY(7 - y, x)] = leds[XY(7 - x, y)];
|
leds[XY16(7 - y, x)] = leds[XY16(7 - x, y)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -679,7 +720,7 @@ class Effects {
|
||||||
int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
|
int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
|
||||||
int err = dx + dy, e2;
|
int err = dx + dy, e2;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
leds[XY(x0, y0)] += color;
|
leds[XY16(x0, y0)] += color;
|
||||||
if (x0 == x1 && y0 == y1) break;
|
if (x0 == x1 && y0 == y1) break;
|
||||||
e2 = 2 * err;
|
e2 = 2 * err;
|
||||||
if (e2 > dy) {
|
if (e2 > dy) {
|
||||||
|
@ -723,10 +764,10 @@ class Effects {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillNoise() {
|
void FillNoise() {
|
||||||
for (uint8_t i = 0; i < VPANEL_W; i++) {
|
for (uint16_t i = 0; i < VPANEL_W; i++) {
|
||||||
uint32_t ioffset = noise_scale_x * (i - MATRIX_CENTRE_Y);
|
uint32_t ioffset = noise_scale_x * (i - MATRIX_CENTRE_Y);
|
||||||
|
|
||||||
for (uint8_t j = 0; j < VPANEL_H; j++) {
|
for (uint16_t j = 0; j < VPANEL_H; j++) {
|
||||||
uint32_t joffset = noise_scale_y * (j - MATRIX_CENTRE_Y);
|
uint32_t joffset = noise_scale_y * (j - MATRIX_CENTRE_Y);
|
||||||
|
|
||||||
byte data = inoise16(noise_x + ioffset, noise_y + joffset, noise_z) >> 8;
|
byte data = inoise16(noise_x + ioffset, noise_y + joffset, noise_z) >> 8;
|
||||||
|
@ -752,16 +793,16 @@ class Effects {
|
||||||
// Shift Left: https://codedost.com/c/arraypointers-in-c/c-program-shift-elements-array-left-direction/
|
// Shift Left: https://codedost.com/c/arraypointers-in-c/c-program-shift-elements-array-left-direction/
|
||||||
// Computationally heavier but doesn't need an entire leds2 array
|
// Computationally heavier but doesn't need an entire leds2 array
|
||||||
|
|
||||||
tmp = leds[XY(0, y)];
|
tmp = leds[XY16(0, y)];
|
||||||
for (int m = 0; m < delta; m++)
|
for (int m = 0; m < delta; m++)
|
||||||
{
|
{
|
||||||
// Do this delta time for each row... computationally expensive potentially.
|
// Do this delta time for each row... computationally expensive potentially.
|
||||||
for (int x = 0; x < VPANEL_H; x++)
|
for(int x = 0; x < VPANEL_W; x++)
|
||||||
{
|
{
|
||||||
leds[XY(x, y)] = leds [XY(x + 1, y)];
|
leds[XY16(x, y)] = leds [XY16(x+1, y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
leds[XY(VPANEL_W - 1, y)] = tmp;
|
leds[XY16(VPANEL_W-1, y)] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,7 +814,7 @@ class Effects {
|
||||||
|
|
||||||
// Wrap around
|
// Wrap around
|
||||||
for (int x = VPANEL_W - delta; x < VPANEL_W; x++) {
|
for (int x = VPANEL_W - delta; x < VPANEL_W; x++) {
|
||||||
leds2[XY(x, y)] = leds[XY(x + delta - VPANEL_H, y)];
|
leds2[XY(x, y)] = leds[XY(x + delta - VPANEL_W, y)];
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} // end row loop
|
} // end row loop
|
||||||
|
@ -794,120 +835,20 @@ class Effects {
|
||||||
CRGB tmp = 0;
|
CRGB tmp = 0;
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; x++)
|
||||||
{
|
{
|
||||||
tmp = leds[XY(x, 0)];
|
tmp = leds[XY16(x, 0)];
|
||||||
for (int m = 0; m < delta; m++) // moves
|
for (int m = 0; m < delta; m++) // moves
|
||||||
{
|
{
|
||||||
// Do this delta time for each row... computationally expensive potentially.
|
// Do this delta time for each row... computationally expensive potentially.
|
||||||
for(int y = 0; y < VPANEL_H; y++)
|
for(int y = 0; y < VPANEL_H; y++)
|
||||||
{
|
{
|
||||||
leds[XY(x, y)] = leds [XY(x, y + 1)];
|
leds[XY16(x, y)] = leds [XY16(x, y+1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
leds[XY(x, VPANEL_H - 1)] = tmp;
|
leds[XY16(x, VPANEL_H-1)] = tmp;
|
||||||
}
|
}
|
||||||
} // end column loop
|
} // end column loop
|
||||||
} /// MoveY
|
} /// MoveY
|
||||||
|
|
||||||
void MoveFractionalNoiseX(byte amt = 16) {
|
|
||||||
// move delta pixelwise
|
|
||||||
for (int y = 0; y < VPANEL_H; y++) {
|
|
||||||
uint16_t amount = noise[0][y] * amt;
|
|
||||||
byte delta = 31 - (amount / 256);
|
|
||||||
|
|
||||||
for (int x = 0; x < VPANEL_W - delta; x++) {
|
|
||||||
leds2[XY(x, y)] = leds[XY(x + delta, y)];
|
|
||||||
}
|
|
||||||
for (int x = VPANEL_H - delta; x < VPANEL_W; x++) {
|
|
||||||
leds2[XY(x, y)] = leds[XY(x + delta - VPANEL_W, y)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//move fractions
|
|
||||||
CRGB PixelA;
|
|
||||||
CRGB PixelB;
|
|
||||||
|
|
||||||
for (uint8_t y = 0; y < VPANEL_H; y++) {
|
|
||||||
uint16_t amount = noise[0][y] * amt;
|
|
||||||
byte delta = 31 - (amount / 256);
|
|
||||||
byte fractions = amount - (delta * 256);
|
|
||||||
|
|
||||||
for (uint8_t x = 1; x < VPANEL_W; x++) {
|
|
||||||
PixelA = leds2[XY(x, y)];
|
|
||||||
PixelB = leds2[XY(x - 1, y)];
|
|
||||||
|
|
||||||
PixelA %= 255 - fractions;
|
|
||||||
PixelB %= fractions;
|
|
||||||
|
|
||||||
leds[XY(x, y)] = PixelA + PixelB;
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelA = leds2[XY(0, y)];
|
|
||||||
PixelB = leds2[XY(VPANEL_W - 1, y)];
|
|
||||||
|
|
||||||
PixelA %= 255 - fractions;
|
|
||||||
PixelB %= fractions;
|
|
||||||
|
|
||||||
leds[XY(0, y)] = PixelA + PixelB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MoveFractionalNoiseY(byte amt = 16) {
|
|
||||||
// move delta pixelwise
|
|
||||||
for (int x = 0; x < VPANEL_W; x++) {
|
|
||||||
uint16_t amount = noise[x][0] * amt;
|
|
||||||
byte delta = 31 - (amount / 256);
|
|
||||||
|
|
||||||
for (int y = 0; y < VPANEL_W - delta; y++) {
|
|
||||||
leds2[XY(x, y)] = leds[XY(x, y + delta)];
|
|
||||||
}
|
|
||||||
for (int y = VPANEL_W - delta; y < VPANEL_W; y++) {
|
|
||||||
leds2[XY(x, y)] = leds[XY(x, y + delta - VPANEL_W)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//move fractions
|
|
||||||
CRGB PixelA;
|
|
||||||
CRGB PixelB;
|
|
||||||
|
|
||||||
for (uint8_t x = 0; x < VPANEL_H; x++) {
|
|
||||||
uint16_t amount = noise[x][0] * amt;
|
|
||||||
byte delta = 31 - (amount / 256);
|
|
||||||
byte fractions = amount - (delta * 256);
|
|
||||||
|
|
||||||
for (uint8_t y = 1; y < VPANEL_W; y++) {
|
|
||||||
PixelA = leds2[XY(x, y)];
|
|
||||||
PixelB = leds2[XY(x, y - 1)];
|
|
||||||
|
|
||||||
PixelA %= 255 - fractions;
|
|
||||||
PixelB %= fractions;
|
|
||||||
|
|
||||||
leds[XY(x, y)] = PixelA + PixelB;
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelA = leds2[XY(x, 0)];
|
|
||||||
PixelB = leds2[XY(x, VPANEL_W - 1)];
|
|
||||||
|
|
||||||
PixelA %= 255 - fractions;
|
|
||||||
PixelB %= fractions;
|
|
||||||
|
|
||||||
leds[XY(x, 0)] = PixelA + PixelB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void standardNoiseSmearing() {
|
|
||||||
noise_x += 1000;
|
|
||||||
noise_y += 1000;
|
|
||||||
noise_scale_x = 4000;
|
|
||||||
noise_scale_y = 4000;
|
|
||||||
FillNoise();
|
|
||||||
|
|
||||||
MoveX(3);
|
|
||||||
MoveFractionalNoiseY(4);
|
|
||||||
|
|
||||||
MoveY(3);
|
|
||||||
MoveFractionalNoiseX(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
// dim all pixels on the display
|
// dim all pixels on the display
|
||||||
uint8_t dim = beatsin8(2, 170, 250);
|
uint8_t dim = beatsin8(2, 170, 250);
|
||||||
effects.DimAll(dim); effects.ShowFrame();
|
effects.DimAll(dim);
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Boid boid = boids[i];
|
Boid boid = boids[i];
|
||||||
|
@ -66,7 +66,8 @@ public:
|
||||||
boids[i] = boid;
|
boids[i] = boid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 15;
|
effects.ShowFrame();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
73
examples/ChainedPanelsAuroraDemo/PatternBounce.h
Normal file
73
examples/ChainedPanelsAuroraDemo/PatternBounce.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternBounce_H
|
||||||
|
|
||||||
|
class PatternBounce : public Drawable {
|
||||||
|
private:
|
||||||
|
static const int count = 32;
|
||||||
|
PVector gravity = PVector(0, 0.0125);
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternBounce() {
|
||||||
|
name = (char *)"Bounce";
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
unsigned int colorWidth = 256 / count;
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
Boid boid = Boid(i, 0);
|
||||||
|
boid.velocity.x = 0;
|
||||||
|
boid.velocity.y = i * -0.01;
|
||||||
|
boid.colorIndex = colorWidth * i;
|
||||||
|
boid.maxforce = 10;
|
||||||
|
boid.maxspeed = 10;
|
||||||
|
boids[i] = boid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
// dim all pixels on the display
|
||||||
|
effects.DimAll(170); effects.ShowFrame();
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
Boid boid = boids[i];
|
||||||
|
|
||||||
|
boid.applyForce(gravity);
|
||||||
|
|
||||||
|
boid.update();
|
||||||
|
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(boid.location.x, boid.location.y, effects.ColorFromCurrentPalette(boid.colorIndex));
|
||||||
|
|
||||||
|
if (boid.location.y >= VPANEL_H - 1) {
|
||||||
|
boid.location.y = VPANEL_H - 1;
|
||||||
|
boid.velocity.y *= -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
boids[i] = boid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
219
examples/ChainedPanelsAuroraDemo/PatternCube.h
Normal file
219
examples/ChainedPanelsAuroraDemo/PatternCube.h
Normal file
|
@ -0,0 +1,219 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Portions of this code are adapted from Noel Bundy's work: https://github.com/TwystNeko/Object3d
|
||||||
|
* Copyright (c) 2014 Noel Bundy
|
||||||
|
*
|
||||||
|
* Portions of this code are adapted from the Petty library: https://code.google.com/p/peggy/
|
||||||
|
* Copyright (c) 2008 Windell H Oskay. All right reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternCube_H
|
||||||
|
#define PatternCube_H
|
||||||
|
|
||||||
|
class PatternCube : public Drawable {
|
||||||
|
private:
|
||||||
|
float focal = 30; // Focal of the camera
|
||||||
|
int cubeWidth = 28; // Cube size
|
||||||
|
float Angx = 20.0, AngxSpeed = 0.05; // rotation (angle+speed) around X-axis
|
||||||
|
float Angy = 10.0, AngySpeed = 0.05; // rotation (angle+speed) around Y-axis
|
||||||
|
float Ox = 15.5, Oy = 15.5; // position (x,y) of the frame center
|
||||||
|
int zCamera = 110; // distance from cube to the eye of the camera
|
||||||
|
|
||||||
|
// Local vertices
|
||||||
|
Vertex local[8];
|
||||||
|
// Camera aligned vertices
|
||||||
|
Vertex aligned[8];
|
||||||
|
// On-screen projected vertices
|
||||||
|
Point screen[8];
|
||||||
|
// Faces
|
||||||
|
squareFace face[6];
|
||||||
|
// Edges
|
||||||
|
EdgePoint edge[12];
|
||||||
|
int nbEdges;
|
||||||
|
// ModelView matrix
|
||||||
|
float m00, m01, m02, m10, m11, m12, m20, m21, m22;
|
||||||
|
|
||||||
|
// constructs the cube
|
||||||
|
void make(int w)
|
||||||
|
{
|
||||||
|
nbEdges = 0;
|
||||||
|
|
||||||
|
local[0].set(-w, w, w);
|
||||||
|
local[1].set(w, w, w);
|
||||||
|
local[2].set(w, -w, w);
|
||||||
|
local[3].set(-w, -w, w);
|
||||||
|
local[4].set(-w, w, -w);
|
||||||
|
local[5].set(w, w, -w);
|
||||||
|
local[6].set(w, -w, -w);
|
||||||
|
local[7].set(-w, -w, -w);
|
||||||
|
|
||||||
|
face[0].set(1, 0, 3, 2);
|
||||||
|
face[1].set(0, 4, 7, 3);
|
||||||
|
face[2].set(4, 0, 1, 5);
|
||||||
|
face[3].set(4, 5, 6, 7);
|
||||||
|
face[4].set(1, 2, 6, 5);
|
||||||
|
face[5].set(2, 3, 7, 6);
|
||||||
|
|
||||||
|
int f, i;
|
||||||
|
for (f = 0; f < 6; f++)
|
||||||
|
{
|
||||||
|
for (i = 0; i < face[f].length; i++)
|
||||||
|
{
|
||||||
|
face[f].ed[i] = this->findEdge(face[f].sommets[i], face[f].sommets[i ? i - 1 : face[f].length - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// finds edges from faces
|
||||||
|
int findEdge(int a, int b)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < nbEdges; i++)
|
||||||
|
if ((edge[i].x == a && edge[i].y == b) || (edge[i].x == b && edge[i].y == a))
|
||||||
|
return i;
|
||||||
|
edge[nbEdges++].set(a, b);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rotates according to angle x&y
|
||||||
|
void rotate(float angx, float angy)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float cx = cos(angx);
|
||||||
|
float sx = sin(angx);
|
||||||
|
float cy = cos(angy);
|
||||||
|
float sy = sin(angy);
|
||||||
|
|
||||||
|
m00 = cy;
|
||||||
|
m01 = 0;
|
||||||
|
m02 = -sy;
|
||||||
|
m10 = sx * sy;
|
||||||
|
m11 = cx;
|
||||||
|
m12 = sx * cy;
|
||||||
|
m20 = cx * sy;
|
||||||
|
m21 = -sx;
|
||||||
|
m22 = cx * cy;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
aligned[i].x = m00 * local[i].x + m01 * local[i].y + m02 * local[i].z;
|
||||||
|
aligned[i].y = m10 * local[i].x + m11 * local[i].y + m12 * local[i].z;
|
||||||
|
aligned[i].z = m20 * local[i].x + m21 * local[i].y + m22 * local[i].z + zCamera;
|
||||||
|
|
||||||
|
screen[i].x = floor((Ox + focal * aligned[i].x / aligned[i].z));
|
||||||
|
screen[i].y = floor((Oy - focal * aligned[i].y / aligned[i].z));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 12; i++)
|
||||||
|
edge[i].visible = false;
|
||||||
|
|
||||||
|
Point *pa, *pb, *pc;
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
pa = screen + face[i].sommets[0];
|
||||||
|
pb = screen + face[i].sommets[1];
|
||||||
|
pc = screen + face[i].sommets[2];
|
||||||
|
|
||||||
|
boolean back = ((pb->x - pa->x) * (pc->y - pa->y) - (pb->y - pa->y) * (pc->x - pa->x)) < 0;
|
||||||
|
if (!back)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
edge[face[i].ed[j]].visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte hue = 0;
|
||||||
|
int step = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternCube() {
|
||||||
|
name = (char *)"Cube";
|
||||||
|
make(cubeWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
uint8_t blurAmount = beatsin8(2, 10, 255);
|
||||||
|
|
||||||
|
#if FASTLED_VERSION >= 3001000
|
||||||
|
blur2d(effects.leds, VPANEL_W, VPANEL_H, blurAmount);
|
||||||
|
#else
|
||||||
|
effects.DimAll(blurAmount); effects.ShowFrame();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
zCamera = beatsin8(2, 100, 140);
|
||||||
|
AngxSpeed = beatsin8(3, 1, 10) / 100.0f;
|
||||||
|
AngySpeed = beatcos8(5, 1, 10) / 100.0f;
|
||||||
|
|
||||||
|
// Update values
|
||||||
|
Angx += AngxSpeed;
|
||||||
|
Angy += AngySpeed;
|
||||||
|
if (Angx >= TWO_PI)
|
||||||
|
Angx -= TWO_PI;
|
||||||
|
if (Angy >= TWO_PI)
|
||||||
|
Angy -= TWO_PI;
|
||||||
|
|
||||||
|
rotate(Angx, Angy);
|
||||||
|
|
||||||
|
// Draw cube
|
||||||
|
int i;
|
||||||
|
|
||||||
|
CRGB color = effects.ColorFromCurrentPalette(hue, 128);
|
||||||
|
|
||||||
|
// Backface
|
||||||
|
EdgePoint *e;
|
||||||
|
for (i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
e = edge + i;
|
||||||
|
if (!e->visible) {
|
||||||
|
matrix.drawLine(screen[e->x].x, screen[e->x].y, screen[e->y].x, screen[e->y].y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color = effects.ColorFromCurrentPalette(hue, 255);
|
||||||
|
|
||||||
|
// Frontface
|
||||||
|
for (i = 0; i < 12; i++)
|
||||||
|
{
|
||||||
|
e = edge + i;
|
||||||
|
if (e->visible)
|
||||||
|
{
|
||||||
|
matrix.drawLine(screen[e->x].x, screen[e->x].y, screen[e->y].x, screen[e->y].y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
step++;
|
||||||
|
if (step == 8) {
|
||||||
|
step = 0;
|
||||||
|
hue++;
|
||||||
|
}
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -70,7 +70,7 @@ class PatternElectricMandala : public Drawable {
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
#if FASTLED_VERSION >= 3001000
|
#if FASTLED_VERSION >= 3001000
|
||||||
// a new parameter set every 15 seconds
|
// a new parameter set every 15 seconds
|
||||||
EVERY_N_SECONDS(25) {
|
EVERY_N_SECONDS(15) {
|
||||||
//SetupRandomPalette3();
|
//SetupRandomPalette3();
|
||||||
dy = random16(500) - 250; // random16(2000) - 1000 is pretty fast but works fine, too
|
dy = random16(500) - 250; // random16(2000) - 1000 is pretty fast but works fine, too
|
||||||
dx = random16(500) - 250;
|
dx = random16(500) - 250;
|
||||||
|
@ -92,13 +92,13 @@ class PatternElectricMandala : public Drawable {
|
||||||
|
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
return 0;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show just one layer
|
// show just one layer
|
||||||
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
|
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
|
||||||
for (uint8_t i = 0; i < VPANEL_W; i++) {
|
for (uint16_t i = 0; i < VPANEL_W; i++) {
|
||||||
for (uint8_t j = 0; j < VPANEL_H; j++) {
|
for (uint16_t j = 0; j < VPANEL_H; j++) {
|
||||||
|
|
||||||
uint8_t color = noise[i][j];
|
uint8_t color = noise[i][j];
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class PatternElectricMandala : public Drawable {
|
||||||
// assign a color depending on the actual palette
|
// assign a color depending on the actual palette
|
||||||
CRGB pixel = ColorFromPalette(effects.currentPalette, colorrepeat * (color + colorshift), bri);
|
CRGB pixel = ColorFromPalette(effects.currentPalette, colorrepeat * (color + colorshift), bri);
|
||||||
|
|
||||||
effects.leds[XY(i, j)] = pixel;
|
effects.leds[XY16(i, j)] = pixel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,28 @@
|
||||||
/*
|
/*
|
||||||
Aurora: https://github.com/pixelmatix/aurora
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
Copyright (c) 2014 Jason Coon
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
|
* Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
|
||||||
Copyright (c) 2013 FastLED
|
* Copyright (c) 2013 FastLED
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
* the Software without restriction, including without limitation the rights to
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
subject to the following conditions:
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in all
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Note: (Kosso) : Doesn't look good with certain palettes.
|
|
||||||
|
|
||||||
#ifndef PatternFire_H
|
#ifndef PatternFire_H
|
||||||
#define PatternFire_H
|
#define PatternFire_H
|
||||||
|
|
||||||
|
@ -92,12 +90,10 @@ class PatternFire : public Drawable {
|
||||||
colorIndex = scale8(colorIndex, 200);
|
colorIndex = scale8(colorIndex, 200);
|
||||||
|
|
||||||
// override color 0 to ensure a black background?
|
// override color 0 to ensure a black background?
|
||||||
//if (colorIndex != 0) {
|
if (colorIndex != 0)
|
||||||
// effects.leds[xy] = CRGB::Black;
|
// effects.leds[xy] = CRGB::Black;
|
||||||
//}
|
// else
|
||||||
//else {
|
|
||||||
effects.leds[xy] = effects.ColorFromCurrentPalette(colorIndex);
|
effects.leds[xy] = effects.ColorFromCurrentPalette(colorIndex);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +105,10 @@ class PatternFire : public Drawable {
|
||||||
noise_scale_y = 4000;
|
noise_scale_y = 4000;
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
// effects.MoveX(2);
|
effects.MoveX(2);
|
||||||
effects.MoveFractionalNoiseX(2);
|
effects.MoveFractionalNoiseX(2);
|
||||||
|
|
||||||
|
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
return 15;
|
return 15;
|
||||||
|
|
64
examples/ChainedPanelsAuroraDemo/PatternIncrementalDrift2.h
Normal file
64
examples/ChainedPanelsAuroraDemo/PatternIncrementalDrift2.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternIncrementalDrift2_H
|
||||||
|
#define PatternIncrementalDrift2_H
|
||||||
|
|
||||||
|
class PatternIncrementalDrift2 : public Drawable {
|
||||||
|
public:
|
||||||
|
PatternIncrementalDrift2() {
|
||||||
|
name = (char *)"Incremental Drift Rose";
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
uint8_t dim = beatsin8(2, 170, 250);
|
||||||
|
effects.DimAll(dim); effects.ShowFrame();
|
||||||
|
|
||||||
|
for (int i = 2; i < VPANEL_H / 2; ++i)
|
||||||
|
//for (uint8_t i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
CRGB color;
|
||||||
|
|
||||||
|
uint8_t x = 0;
|
||||||
|
uint8_t y = 0;
|
||||||
|
|
||||||
|
if (i < 16) {
|
||||||
|
x = beatcos8((i + 1) * 2, i, VPANEL_W - i);
|
||||||
|
y = beatsin8((i + 1) * 2, i, VPANEL_H - i);
|
||||||
|
color = effects.ColorFromCurrentPalette(i * 14);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = beatsin8((32 - i) * 2, VPANEL_W - i, i + 1);
|
||||||
|
y = beatcos8((32 - i) * 2, VPANEL_H - i, i + 1);
|
||||||
|
color = effects.ColorFromCurrentPalette((31 - i) * 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(x, y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -31,7 +31,9 @@ public:
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
// dim all pixels on the display slightly
|
// dim all pixels on the display slightly
|
||||||
// to 250/255 (98%) of their current brightness
|
// to 250/255 (98%) of their current brightness
|
||||||
effects.DimAll(250); effects.ShowFrame();
|
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, 250);
|
||||||
|
// effects.DimAll(250); effects.ShowFrame();
|
||||||
|
|
||||||
|
|
||||||
// the Effects class has some sample oscillators
|
// the Effects class has some sample oscillators
|
||||||
// that move from 0 to 255 at different speeds
|
// that move from 0 to 255 at different speeds
|
||||||
|
@ -51,7 +53,8 @@ public:
|
||||||
// draw a pixel at x,y using a color from the current palette
|
// draw a pixel at x,y using a color from the current palette
|
||||||
effects.Pixel(x, y, hue);
|
effects.Pixel(x, y, hue);
|
||||||
|
|
||||||
return 15;
|
effects.ShowFrame();
|
||||||
|
return 30;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
154
examples/ChainedPanelsAuroraDemo/PatternInvaders.h
Normal file
154
examples/ChainedPanelsAuroraDemo/PatternInvaders.h
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Inspired by 'Space Invader Generator': https://the8bitpimp.wordpress.com/2013/05/07/space-invader-generator
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternInvaders_H
|
||||||
|
#define PatternInvaders_H
|
||||||
|
|
||||||
|
class PatternInvadersSmall : public Drawable {
|
||||||
|
private:
|
||||||
|
uint8_t x = 1;
|
||||||
|
uint8_t y = 1;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternInvadersSmall() {
|
||||||
|
name = (char *)"Invaders Small";
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
matrix.fillScreen(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
for (int j = 0; j < 5; j++) {
|
||||||
|
CRGB color = CRGB::Black;
|
||||||
|
|
||||||
|
if (random(0, 2) == 1) color = color1;
|
||||||
|
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(x + i, y + j, color);
|
||||||
|
|
||||||
|
if (i < 2)
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(x + (4 - i), y + j, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x += 6;
|
||||||
|
if (x > 25) {
|
||||||
|
x = 1;
|
||||||
|
y += 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y > 25) y = x = 1;
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 125;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class PatternInvadersMedium : public Drawable {
|
||||||
|
private:
|
||||||
|
uint8_t x = 0;
|
||||||
|
uint8_t y = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternInvadersMedium() {
|
||||||
|
name = (char *)"Invaders Medium";
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
matrix.fillScreen(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
for (int j = 0; j < 5; j++) {
|
||||||
|
CRGB color = CRGB::Black;
|
||||||
|
|
||||||
|
if (random(0, 2) == 1) color = color1;
|
||||||
|
|
||||||
|
matrix.fillRect(x + (i * 2), y + (j * 2), x + (i * 2 + 1), y + (j * 2 + 1), color);
|
||||||
|
|
||||||
|
if (i < 2)
|
||||||
|
matrix.fillRect(x + (8 - i * 2), y + (j * 2), x + (9 - i * 2), y + (j * 2 + 1), color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x += 11;
|
||||||
|
if (x > 22) {
|
||||||
|
x = 0;
|
||||||
|
y += 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y > 22) y = x = 0;
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class PatternInvadersLarge : public Drawable {
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternInvadersLarge() {
|
||||||
|
name = (char *)"Invaders Large";
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
matrix.fillScreen(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
matrix.fillScreen(0);
|
||||||
|
|
||||||
|
CRGB color1 = effects.ColorFromCurrentPalette(random(0, 255));
|
||||||
|
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
for (int y = 0; y < 5; y++) {
|
||||||
|
CRGB color = CRGB::Black;
|
||||||
|
|
||||||
|
if (random(0, 2) == 1) {
|
||||||
|
color = color1;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix.fillRect(1 + x * 6, 1 + y * 6, 5 + x * 6, 5 + y * 6, color);
|
||||||
|
|
||||||
|
if (x < 2)
|
||||||
|
matrix.fillRect(1 + (4 - x) * 6, 1 + y * 6, 5 + (4 - x) * 6, 5 + y * 6, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 2000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -246,7 +246,7 @@ public:
|
||||||
if (algorithm >= algorithmCount)
|
if (algorithm >= algorithmCount)
|
||||||
algorithm = 0;
|
algorithm = 0;
|
||||||
|
|
||||||
return 1000;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
@ -255,7 +255,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
matrix.fillScreen(0);
|
effects.ClearFrame();
|
||||||
cellCount = 0;
|
cellCount = 0;
|
||||||
hue = 0;
|
hue = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ public:
|
||||||
|
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
|
|
||||||
for (byte x = 0; x < VPANEL_W; x++) {
|
for (uint16_t x = 0; x < VPANEL_W; x++) {
|
||||||
for (byte y = 0; y < VPANEL_H; y++) {
|
for (uint16_t y = 0; y < VPANEL_H; y++) {
|
||||||
effects.leds[XY(x, y)] = (x ^ y ^ flip) < count ? effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) : CRGB::Black;
|
effects.leds[XY16(x, y)] = (x ^ y ^ flip) < count ? effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) : CRGB::Black;
|
||||||
|
|
||||||
// The below is more pleasant
|
// The below is more pleasant
|
||||||
// effects.leds[XY(x, y)] = effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) ;
|
// effects.leds[XY(x, y)] = effects.ColorFromCurrentPalette(((x ^ y) << 2) + generation) ;
|
||||||
|
@ -66,7 +66,6 @@ public:
|
||||||
|
|
||||||
// show it ffs!
|
// show it ffs!
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
return 60;
|
return 60;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,10 +65,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(8);
|
effects.MoveX(8);
|
||||||
// effects.MoveFractionalNoiseX();
|
effects.MoveFractionalNoiseX();
|
||||||
|
|
||||||
effects.MoveY(8);
|
effects.MoveY(8);
|
||||||
// effects.MoveFractionalNoiseY();
|
effects.MoveFractionalNoiseY();
|
||||||
|
|
||||||
patternNoiseSmearingHue++;
|
patternNoiseSmearingHue++;
|
||||||
|
|
||||||
|
@ -103,10 +103,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(3);
|
effects.MoveX(3);
|
||||||
// effects.MoveFractionalNoiseY(4);
|
effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
effects.MoveY(3);
|
effects.MoveY(3);
|
||||||
//effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
patternNoiseSmearingHue++;
|
patternNoiseSmearingHue++;
|
||||||
|
|
||||||
|
@ -137,10 +137,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(3);
|
effects.MoveX(3);
|
||||||
// effects.MoveFractionalNoiseY(4);
|
effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
effects.MoveY(3);
|
effects.MoveY(3);
|
||||||
// effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
@ -170,10 +170,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(8);
|
effects.MoveX(8);
|
||||||
// effects.MoveFractionalNoiseX();
|
effects.MoveFractionalNoiseX();
|
||||||
|
|
||||||
effects.MoveY(8);
|
effects.MoveY(8);
|
||||||
// effects.MoveFractionalNoiseY();
|
effects.MoveFractionalNoiseY();
|
||||||
|
|
||||||
patternNoiseSmearingHue++;
|
patternNoiseSmearingHue++;
|
||||||
|
|
||||||
|
@ -206,10 +206,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(3);
|
effects.MoveX(3);
|
||||||
// effects.MoveFractionalNoiseY(4);
|
effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
effects.MoveY(4);
|
effects.MoveY(4);
|
||||||
// effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -241,10 +241,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(3);
|
effects.MoveX(3);
|
||||||
// effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
effects.MoveY(3);
|
effects.MoveY(3);
|
||||||
//effects.MoveFractionalNoiseY(4);
|
effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -261,8 +261,8 @@ public:
|
||||||
effects.DimAll(170); effects.ShowFrame();
|
effects.DimAll(170); effects.ShowFrame();
|
||||||
|
|
||||||
// draw a rainbow color palette
|
// draw a rainbow color palette
|
||||||
for (uint8_t y = 0; y < MATRIX_HEIGHT; y++) {
|
for (uint8_t y = 0; y < VPANEL_H; y++) {
|
||||||
for (uint8_t x = 0; x < MATRIX_WIDTH; x++) {
|
for (uint8_t x = 0; x < VPANEL_W; x++) {
|
||||||
effects.leds[XY(x, y)] += effects.ColorFromCurrentPalette(x * 8, y * 8 + 7);
|
effects.leds[XY(x, y)] += effects.ColorFromCurrentPalette(x * 8, y * 8 + 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ public:
|
||||||
//effects.MoveFractionalNoiseY(4);
|
//effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
effects.MoveY(3);
|
effects.MoveY(3);
|
||||||
// effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -327,10 +327,10 @@ public:
|
||||||
effects.FillNoise();
|
effects.FillNoise();
|
||||||
|
|
||||||
effects.MoveX(3);
|
effects.MoveX(3);
|
||||||
// effects.MoveFractionalNoiseY(4);
|
effects.MoveFractionalNoiseY(4);
|
||||||
|
|
||||||
effects.MoveY(3);
|
effects.MoveY(3);
|
||||||
// effects.MoveFractionalNoiseX(4);
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
#ifndef PatternPendulumWave_H
|
#ifndef PatternPendulumWave_H
|
||||||
#define PatternPendulumWave_H
|
#define PatternPendulumWave_H
|
||||||
|
|
||||||
|
#define WAVE_BPM 25
|
||||||
|
#define AMP_BPM 2
|
||||||
|
#define SKEW_BPM 4
|
||||||
|
#define WAVE_TIMEMINSKEW VPANEL_W/8
|
||||||
|
#define WAVE_TIMEMAXSKEW VPANEL_W/2
|
||||||
|
|
||||||
class PatternPendulumWave : public Drawable {
|
class PatternPendulumWave : public Drawable {
|
||||||
public:
|
public:
|
||||||
PatternPendulumWave() {
|
PatternPendulumWave() {
|
||||||
|
@ -41,15 +47,19 @@ class PatternPendulumWave : public Drawable {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
effects.DimAll(170); effects.ShowFrame();
|
effects.ClearFrame();
|
||||||
|
|
||||||
for (int x = 0; x < VPANEL_W; x++)
|
for (int x = 0; x < VPANEL_W; ++x)
|
||||||
{
|
{
|
||||||
uint8_t y = beatsin8(x + VPANEL_W, 0, VPANEL_H);
|
uint16_t amp = beatsin16(AMP_BPM, VPANEL_H/8, VPANEL_H-1);
|
||||||
|
uint16_t offset = (VPANEL_H - beatsin16(AMP_BPM, 0, VPANEL_H))/2;
|
||||||
|
|
||||||
|
uint8_t y = beatsin16(WAVE_BPM, 0, amp, x*beatsin16(SKEW_BPM, WAVE_TIMEMINSKEW, WAVE_TIMEMAXSKEW)) + offset;
|
||||||
|
|
||||||
effects.drawBackgroundFastLEDPixelCRGB(x, y, effects.ColorFromCurrentPalette(x * 7));
|
effects.drawBackgroundFastLEDPixelCRGB(x, y, effects.ColorFromCurrentPalette(x * 7));
|
||||||
}
|
}
|
||||||
|
effects.ShowFrame();
|
||||||
return 15;
|
return 20;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
82
examples/ChainedPanelsAuroraDemo/PatternPulse.h
Normal file
82
examples/ChainedPanelsAuroraDemo/PatternPulse.h
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Based at least in part on someone else's work that I can no longer find.
|
||||||
|
* Please let me know if you recognize any of this code!
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternPulse_H
|
||||||
|
#define PatternPulse_H
|
||||||
|
|
||||||
|
class PatternPulse : public Drawable {
|
||||||
|
private:
|
||||||
|
int hue;
|
||||||
|
int centerX = 0;
|
||||||
|
int centerY = 0;
|
||||||
|
int step = -1;
|
||||||
|
int maxSteps = 16;
|
||||||
|
float fadeRate = 0.8;
|
||||||
|
int diff;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternPulse() {
|
||||||
|
name = (char *)"Pulse";
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
effects.DimAll(235);
|
||||||
|
|
||||||
|
if (step == -1) {
|
||||||
|
centerX = random(32);
|
||||||
|
centerY = random(32);
|
||||||
|
hue = random(256); // 170;
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 0) {
|
||||||
|
matrix.drawCircle(centerX, centerY, step, effects.ColorFromCurrentPalette(hue));
|
||||||
|
step++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (step < maxSteps) {
|
||||||
|
// initial pulse
|
||||||
|
matrix.drawCircle(centerX, centerY, step, effects.ColorFromCurrentPalette(hue, pow(fadeRate, step - 2) * 255));
|
||||||
|
|
||||||
|
// secondary pulse
|
||||||
|
if (step > 3) {
|
||||||
|
matrix.drawCircle(centerX, centerY, step - 3, effects.ColorFromCurrentPalette(hue, pow(fadeRate, step - 2) * 255));
|
||||||
|
}
|
||||||
|
step++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
step = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
effects.standardNoiseSmearing();
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -60,17 +60,17 @@ class PatternSimplexNoise : public Drawable {
|
||||||
|
|
||||||
effects.ShowFrame();
|
effects.ShowFrame();
|
||||||
|
|
||||||
return 0;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show just one layer
|
// show just one layer
|
||||||
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
|
void ShowNoiseLayer(byte layer, byte colorrepeat, byte colorshift) {
|
||||||
for (uint8_t i = 0; i < VPANEL_W; i++) {
|
for (uint16_t i = 0; i < VPANEL_W; i++) {
|
||||||
for (uint8_t j = 0; j < VPANEL_H; j++) {
|
for (uint16_t j = 0; j < VPANEL_H; j++) {
|
||||||
uint8_t pixel = noise[i][j];
|
uint8_t pixel = noise[i][j];
|
||||||
|
|
||||||
// assign a color depending on the actual palette
|
// assign a color depending on the actual palette
|
||||||
effects.leds[XY(i, j)] = effects.ColorFromCurrentPalette(colorrepeat * (pixel + colorshift), pixel);
|
effects.leds[XY16(i, j)] = effects.ColorFromCurrentPalette(colorrepeat * (pixel + colorshift), pixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int snakeCount = 40;
|
static const int snakeCount = 6;
|
||||||
Snake snakes[snakeCount];
|
Snake snakes[snakeCount];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
113
examples/ChainedPanelsAuroraDemo/PatternSpark.h
Normal file
113
examples/ChainedPanelsAuroraDemo/PatternSpark.h
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Portions of this code are adapted from FastLED Fire2012 example by Mark Kriegsman: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012WithPalette
|
||||||
|
* Copyright (c) 2013 FastLED
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternSpark_H
|
||||||
|
#define PatternSpark_H
|
||||||
|
|
||||||
|
class PatternSpark : public Drawable {
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternSpark() {
|
||||||
|
name = (char *)"Spark";
|
||||||
|
}
|
||||||
|
|
||||||
|
// There are two main parameters you can play with to control the look and
|
||||||
|
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
|
||||||
|
// in step 3 above).
|
||||||
|
//
|
||||||
|
// COOLING: How much does the air cool as it rises?
|
||||||
|
// Less cooling = taller flames. More cooling = shorter flames.
|
||||||
|
// Default 55, suggested range 20-100
|
||||||
|
uint8_t cooling = 100;
|
||||||
|
|
||||||
|
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
|
||||||
|
// Higher chance = more roaring fire. Lower chance = more flickery fire.
|
||||||
|
// Default 120, suggested range 50-200.
|
||||||
|
uint8_t sparking = 50;
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
// Add entropy to random number generator; we use a lot of it.
|
||||||
|
random16_add_entropy( random16());
|
||||||
|
|
||||||
|
effects.DimAll(235); effects.ShowFrame();
|
||||||
|
|
||||||
|
for (uint8_t x = 0; x < VPANEL_W; x++) {
|
||||||
|
// Step 1. Cool down every cell a little
|
||||||
|
for (int y = 0; y < VPANEL_H; y++) {
|
||||||
|
int xy = XY(x, y);
|
||||||
|
heat[xy] = qsub8(heat[xy], random8(0, ((cooling * 10) / VPANEL_H) + 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2. Heat from each cell drifts 'up' and diffuses a little
|
||||||
|
for (int y = 0; y < VPANEL_H; y++) {
|
||||||
|
heat[XY(x, y)] = (heat[XY(x, y + 1)] + heat[XY(x, y + 2)] + heat[XY(x, y + 2)]) / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2. Randomly ignite new 'sparks' of heat
|
||||||
|
if (random8() < sparking) {
|
||||||
|
uint8_t xt = random8(MATRIX_CENTRE_X - 2, MATRIX_CENTER_X + 3);
|
||||||
|
|
||||||
|
int xy = XY(xt, VPANEL_H - 1);
|
||||||
|
heat[xy] = qadd8(heat[xy], random8(160, 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 4. Map from heat cells to LED colors
|
||||||
|
for (int y = 0; y < VPANEL_H; y++) {
|
||||||
|
int xy = XY(x, y);
|
||||||
|
byte colorIndex = heat[xy];
|
||||||
|
|
||||||
|
// Recommend that you use values 0-240 rather than
|
||||||
|
// the usual 0-255, as the last 15 colors will be
|
||||||
|
// 'wrapping around' from the hot end to the cold end,
|
||||||
|
// which looks wrong.
|
||||||
|
colorIndex = scale8(colorIndex, 240);
|
||||||
|
|
||||||
|
// override color 0 to ensure a black background?
|
||||||
|
if (colorIndex != 0)
|
||||||
|
// effects.leds[xy] = CRGB::Black;
|
||||||
|
// else
|
||||||
|
effects.leds[xy] = effects.ColorFromCurrentPalette(colorIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Noise
|
||||||
|
noise_x += 1000;
|
||||||
|
noise_y += 1000;
|
||||||
|
noise_z += 1000;
|
||||||
|
noise_scale_x = 4000;
|
||||||
|
noise_scale_y = 4000;
|
||||||
|
effects.FillNoise();
|
||||||
|
|
||||||
|
effects.MoveX(3);
|
||||||
|
effects.MoveFractionalNoiseX(4);
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
|
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
100
examples/ChainedPanelsAuroraDemo/PatternSpin.h
Normal file
100
examples/ChainedPanelsAuroraDemo/PatternSpin.h
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* Aurora: https://github.com/pixelmatix/aurora
|
||||||
|
* Copyright (c) 2014 Jason Coon
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PatternSpin_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class PatternSpin : public Drawable {
|
||||||
|
public:
|
||||||
|
PatternSpin() {
|
||||||
|
name = (char *)"Spin";
|
||||||
|
}
|
||||||
|
|
||||||
|
float degrees = 0;
|
||||||
|
float radius = 16;
|
||||||
|
|
||||||
|
float speedStart = 1;
|
||||||
|
float velocityStart = 0.6;
|
||||||
|
|
||||||
|
float maxSpeed = 30;
|
||||||
|
|
||||||
|
float speed = speedStart;
|
||||||
|
float velocity = velocityStart;
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
speed = speedStart;
|
||||||
|
velocity = velocityStart;
|
||||||
|
degrees = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
effects.DimAll(190); effects.ShowFrame();
|
||||||
|
|
||||||
|
CRGB color = effects.ColorFromCurrentPalette(speed * 8);
|
||||||
|
|
||||||
|
// start position
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
// target position
|
||||||
|
float targetDegrees = degrees + speed;
|
||||||
|
float targetRadians = radians(targetDegrees);
|
||||||
|
int targetX = (int) (MATRIX_CENTER_X + radius * cos(targetRadians));
|
||||||
|
int targetY = (int) (MATRIX_CENTER_Y - radius * sin(targetRadians));
|
||||||
|
|
||||||
|
float tempDegrees = degrees;
|
||||||
|
|
||||||
|
do{
|
||||||
|
float radians = radians(tempDegrees);
|
||||||
|
x = (int) (MATRIX_CENTER_X + radius * cos(radians));
|
||||||
|
y = (int) (MATRIX_CENTER_Y - radius * sin(radians));
|
||||||
|
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(x, y, color);
|
||||||
|
effects.drawBackgroundFastLEDPixelCRGB(y, x, color);
|
||||||
|
|
||||||
|
tempDegrees += 1;
|
||||||
|
if (tempDegrees >= 360)
|
||||||
|
tempDegrees = 0;
|
||||||
|
} while (x != targetX || y != targetY);
|
||||||
|
|
||||||
|
degrees += speed;
|
||||||
|
|
||||||
|
// add velocity to the particle each pass around the accelerator
|
||||||
|
if (degrees >= 360) {
|
||||||
|
degrees = 0;
|
||||||
|
speed += velocity;
|
||||||
|
if (speed <= speedStart) {
|
||||||
|
speed = speedStart;
|
||||||
|
velocity *= -1;
|
||||||
|
}
|
||||||
|
else if (speed > maxSpeed){
|
||||||
|
speed = maxSpeed - velocity;
|
||||||
|
velocity *= -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -37,7 +37,7 @@ class PatternSpiro : public Drawable {
|
||||||
|
|
||||||
uint8_t spirocount = 1;
|
uint8_t spirocount = 1;
|
||||||
uint8_t spirooffset = 256 / spirocount;
|
uint8_t spirooffset = 256 / spirocount;
|
||||||
boolean spiroincrement = false;
|
boolean spiroincrement = true;
|
||||||
|
|
||||||
boolean handledChange = false;
|
boolean handledChange = false;
|
||||||
|
|
||||||
|
@ -46,8 +46,12 @@ class PatternSpiro : public Drawable {
|
||||||
name = (char *)"Spiro";
|
name = (char *)"Spiro";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void start(){
|
||||||
|
effects.ClearFrame();
|
||||||
|
};
|
||||||
|
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
effects.DimAll(254); effects.ShowFrame();
|
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, 192);
|
||||||
|
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
|
|
||||||
|
@ -100,6 +104,7 @@ class PatternSpiro : public Drawable {
|
||||||
hueoffset += 1;
|
hueoffset += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
effects.ShowFrame();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,7 @@ class PatternSwirl : public Drawable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
effects.ClearFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int drawFrame() {
|
unsigned int drawFrame() {
|
||||||
|
@ -46,24 +47,25 @@ class PatternSwirl : public Drawable {
|
||||||
uint8_t blurAmount = beatsin8(2, 10, 255);
|
uint8_t blurAmount = beatsin8(2, 10, 255);
|
||||||
|
|
||||||
#if FASTLED_VERSION >= 3001000
|
#if FASTLED_VERSION >= 3001000
|
||||||
blur2d(effects.leds, VPANEL_W, VPANEL_H, blurAmount);
|
blur2d(effects.leds, VPANEL_W > 255 ? 255 : VPANEL_W, VPANEL_H > 255 ? 255 : VPANEL_H, blurAmount);
|
||||||
#else
|
#else
|
||||||
effects.DimAll(blurAmount);
|
effects.DimAll(blurAmount);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use two out-of-sync sine waves
|
// Use two out-of-sync sine waves
|
||||||
uint8_t i = beatsin8(27, borderWidth, VPANEL_H - borderWidth);
|
uint8_t i = beatsin8(256/VPANEL_H, borderWidth, VPANEL_W - borderWidth);
|
||||||
uint8_t j = beatsin8(41, borderWidth, VPANEL_W - borderWidth);
|
uint8_t j = beatsin8(2048/VPANEL_W, borderWidth, VPANEL_H - borderWidth);
|
||||||
|
|
||||||
// Also calculate some reflections
|
// Also calculate some reflections
|
||||||
uint8_t ni = (VPANEL_W - 1) - i;
|
uint8_t ni = (VPANEL_W - 1) - i;
|
||||||
uint8_t nj = (VPANEL_W - 1) - j;
|
uint8_t nj = (VPANEL_H - 1) - j;
|
||||||
|
|
||||||
// The color of each point shifts over time, each at a different speed.
|
// The color of each point shifts over time, each at a different speed.
|
||||||
uint16_t ms = millis();
|
uint16_t ms = millis();
|
||||||
effects.leds[XY(i, j)] += effects.ColorFromCurrentPalette(ms / 11);
|
effects.leds[XY(i, j)] += effects.ColorFromCurrentPalette(ms / 11);
|
||||||
effects.leds[XY(j, i)] += effects.ColorFromCurrentPalette(ms / 13);
|
//effects.leds[XY(j, i)] += effects.ColorFromCurrentPalette(ms / 13); // this doesn't work for non-square matrixes
|
||||||
effects.leds[XY(ni, nj)] += effects.ColorFromCurrentPalette(ms / 17);
|
effects.leds[XY(ni, nj)] += effects.ColorFromCurrentPalette(ms / 17);
|
||||||
effects.leds[XY(nj, ni)] += effects.ColorFromCurrentPalette(ms / 29);
|
//effects.leds[XY(nj, ni)] += effects.ColorFromCurrentPalette(ms / 29); // this doesn't work for non-square matrixes
|
||||||
effects.leds[XY(i, nj)] += effects.ColorFromCurrentPalette(ms / 37);
|
effects.leds[XY(i, nj)] += effects.ColorFromCurrentPalette(ms / 37);
|
||||||
effects.leds[XY(ni, j)] += effects.ColorFromCurrentPalette(ms / 41);
|
effects.leds[XY(ni, j)] += effects.ColorFromCurrentPalette(ms / 41);
|
||||||
|
|
||||||
|
|
20
examples/ChainedPanelsAuroraDemo/PatternTest.h
Normal file
20
examples/ChainedPanelsAuroraDemo/PatternTest.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
#ifndef PatternTest_H
|
||||||
|
#define PatternTest_H
|
||||||
|
|
||||||
|
class PatternTest : public Drawable {
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
PatternTest() {
|
||||||
|
name = (char *)"Test Pattern";
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int drawFrame() {
|
||||||
|
|
||||||
|
matrix.fillScreen(matrix.color565(128, 0, 0));
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -34,52 +34,75 @@
|
||||||
*
|
*
|
||||||
* Commented out patterns are due to the fact they either didn't work properly with a non-square display,
|
* Commented out patterns are due to the fact they either didn't work properly with a non-square display,
|
||||||
* or from my personal opinion, are crap.
|
* or from my personal opinion, are crap.
|
||||||
*
|
|
||||||
* Kosso: I have removed the crappy ones and added a less crappy (and working!) Fire demo ;)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#include "PaletteFireKoz.h" // Added by Kosso
|
|
||||||
#include "PatternFireKoz.h" // Added by Kosso
|
#include "PatternTest.h"
|
||||||
|
//#include "PatternNoiseSmearing.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternSpiro.h"
|
#include "PatternSpiro.h"
|
||||||
#include "PatternRadar.h"
|
#include "PatternRadar.h"
|
||||||
#include "PatternSwirl.h"
|
#include "PatternSwirl.h"
|
||||||
#include "PatternPendulumWave.h"
|
#include "PatternPendulumWave.h"
|
||||||
#include "PatternFlowField.h"
|
#include "PatternFlowField.h"
|
||||||
#include "PatternIncrementalDrift.h"
|
#include "PatternIncrementalDrift.h"
|
||||||
|
#include "PatternIncrementalDrift2.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternMunch.h"
|
#include "PatternMunch.h"
|
||||||
#include "PatternElectricMandala.h"
|
#include "PatternElectricMandala.h"
|
||||||
|
//#include "PatternSpin.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternSimplexNoise.h"
|
#include "PatternSimplexNoise.h"
|
||||||
#include "PatternWave.h"
|
#include "PatternWave.h"
|
||||||
#include "PatternAttract.h"
|
#include "PatternAttract.h"
|
||||||
|
//#include "PatternBounce.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternFlock.h"
|
#include "PatternFlock.h"
|
||||||
#include "PatternInfinity.h"
|
#include "PatternInfinity.h"
|
||||||
#include "PatternPlasma.h"
|
#include "PatternPlasma.h"
|
||||||
#include "PatternSnake.h"
|
#include "PatternSnake.h"
|
||||||
#include "PatternFire.h" // Not very good.
|
#include "PatternInvaders.h"
|
||||||
|
//#include "PatternCube.h" // Doesn't seem to work, omitting.
|
||||||
|
//#include "PatternFire.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternLife.h"
|
#include "PatternLife.h"
|
||||||
#include "PatternMaze.h"
|
#include "PatternMaze.h"
|
||||||
|
//#include "PatternPulse.h" // Doesn't seem to work, omitting.
|
||||||
|
//#include "PatternSpark.h" // Doesn't seem to work, omitting.
|
||||||
#include "PatternSpiral.h"
|
#include "PatternSpiral.h"
|
||||||
|
|
||||||
|
|
||||||
class Patterns : public Playlist {
|
class Patterns : public Playlist {
|
||||||
private:
|
private:
|
||||||
PatternFireKoz fireKoz;
|
PatternTest patternTest;
|
||||||
|
// PatternRainbowFlag rainbowFlag; // doesn't work
|
||||||
|
// PatternPaletteSmear paletteSmear;
|
||||||
|
// PatternMultipleStream multipleStream; // doesn't work
|
||||||
|
// PatternMultipleStream2 multipleStream2; // doesn't work
|
||||||
|
// PatternMultipleStream3 multipleStream3; // doesn't work
|
||||||
|
// PatternMultipleStream4 multipleStream4; // doesn't work
|
||||||
|
// PatternMultipleStream5 multipleStream5; // doesn't work
|
||||||
|
// PatternMultipleStream8 multipleStream8; // doesn't work
|
||||||
PatternSpiro spiro;
|
PatternSpiro spiro;
|
||||||
|
// PatternRadar radar;
|
||||||
PatternSwirl swirl;
|
PatternSwirl swirl;
|
||||||
PatternPendulumWave pendulumWave;
|
PatternPendulumWave pendulumWave;
|
||||||
PatternFlowField flowField;
|
PatternFlowField flowField;
|
||||||
PatternIncrementalDrift incrementalDrift;
|
PatternIncrementalDrift incrementalDrift;
|
||||||
|
PatternIncrementalDrift2 incrementalDrift2;
|
||||||
PatternMunch munch;
|
PatternMunch munch;
|
||||||
PatternElectricMandala electricMandala;
|
PatternElectricMandala electricMandala;
|
||||||
|
// PatternSpin spin;
|
||||||
PatternSimplexNoise simplexNoise;
|
PatternSimplexNoise simplexNoise;
|
||||||
PatternWave wave;
|
PatternWave wave;
|
||||||
PatternAttract attract;
|
PatternAttract attract;
|
||||||
|
// PatternBounce bounce;
|
||||||
PatternFlock flock;
|
PatternFlock flock;
|
||||||
|
PatternInfinity infinity;
|
||||||
PatternPlasma plasma;
|
PatternPlasma plasma;
|
||||||
|
PatternInvadersSmall invadersSmall;
|
||||||
|
// PatternInvadersMedium invadersMedium;
|
||||||
|
// PatternInvadersLarge invadersLarge;
|
||||||
PatternSnake snake;
|
PatternSnake snake;
|
||||||
PatternFire fire;
|
// PatternCube cube;
|
||||||
|
// PatternFire fire;
|
||||||
PatternLife life;
|
PatternLife life;
|
||||||
PatternMaze maze;
|
PatternMaze maze;
|
||||||
|
// PatternPulse pulse;
|
||||||
|
// PatternSpark spark;
|
||||||
PatternSpiral spiral;
|
PatternSpiral spiral;
|
||||||
|
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
@ -89,29 +112,49 @@ class Patterns : public Playlist {
|
||||||
return currentIndex;
|
return currentIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
const static int PATTERN_COUNT = 18;
|
const static int PATTERN_COUNT = 14;
|
||||||
|
|
||||||
Drawable* shuffledItems[PATTERN_COUNT];
|
Drawable* shuffledItems[PATTERN_COUNT];
|
||||||
|
|
||||||
Drawable* items[PATTERN_COUNT] = {
|
Drawable* items[PATTERN_COUNT] = {
|
||||||
&fireKoz, // added by Kosso
|
// &patternTest, // ok
|
||||||
&spiro,
|
&spiro, // cool
|
||||||
&life,
|
// &paletteSmear, // fail
|
||||||
|
// &multipleStream, // fail
|
||||||
|
// &multipleStream8,// fail
|
||||||
|
// &multipleStream5,// fail
|
||||||
|
// &multipleStream3,// fail
|
||||||
|
// &radar, // fail
|
||||||
|
// &multipleStream4, // fail
|
||||||
|
// &multipleStream2, // fail
|
||||||
|
&life, // ok
|
||||||
&flowField,
|
&flowField,
|
||||||
&pendulumWave,
|
&pendulumWave, //11 ok
|
||||||
&incrementalDrift,
|
|
||||||
&munch,
|
&incrementalDrift, //12 ok
|
||||||
&electricMandala,
|
&incrementalDrift2, // 13 fail
|
||||||
&simplexNoise,
|
&munch, // 14 ok
|
||||||
&wave,
|
// &electricMandala, // 15 ok, but ugly (vortigont)
|
||||||
&attract,
|
// &spin, // 16 ok but repeditivev
|
||||||
&swirl,
|
// &simplexNoise, // 17 - cool!
|
||||||
&flock,
|
// &wave, // 18 ok (can't work with 256+ matrix due to uint8_t vars)
|
||||||
&plasma,
|
// &rainbowFlag, //20 // fail
|
||||||
&snake,
|
&attract, // 21 ok
|
||||||
&fire,
|
// &swirl, // 22 ok, but ugly (vortigont)
|
||||||
&maze,
|
// &bounce, // boncing line crap
|
||||||
&spiral,
|
&flock, // works
|
||||||
|
&infinity, // works
|
||||||
|
&plasma, // works
|
||||||
|
// &invadersSmall, // works ish, but ugly (vortigont)
|
||||||
|
// &invadersMedium, // fail
|
||||||
|
// &invadersLarge, // fail
|
||||||
|
&snake, // ok
|
||||||
|
// &cube, // works ish
|
||||||
|
// &fire, // ok ish
|
||||||
|
&maze, // ok
|
||||||
|
// &pulse,// fail
|
||||||
|
// &spark, // same as fire
|
||||||
|
&spiral, // ok
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -212,11 +255,6 @@ class Patterns : public Playlist {
|
||||||
Serial.println("}");
|
Serial.println("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPatternIndex()
|
|
||||||
{
|
|
||||||
return currentIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * getCurrentPatternName()
|
char * getCurrentPatternName()
|
||||||
{
|
{
|
||||||
return currentItem->name;
|
return currentItem->name;
|
||||||
|
|
Loading…
Reference in a new issue