Skip to content

Instantly share code, notes, and snippets.

@StefanPetrick
Created December 6, 2014 15:59
Show Gist options
  • Save StefanPetrick/e02478d15def4c0736c1 to your computer and use it in GitHub Desktop.
Save StefanPetrick/e02478d15def4c0736c1 to your computer and use it in GitHub Desktop.
cross wipe
// the animation itself
// basically just moves the noise in 2 dimensions
// and oscillates the border for the mapping methods
void CrossNoise2() {
currentPalette = RainbowStripeColors_p;
noisesmoothing = 20;
y[0] += 100;
z[0] += 50;
scale_x[0] = beatsin16(3,1000,10000);
scale_y[0] = beatsin16(2,1000,10000);
FillNoise(0);
byte border = beatsin8(8, 20, 236);
CrossMapping(1, border);
}
// uses one of two mapping methods depending on the noise value
void CrossMapping(byte colorrepeat, byte border) {
for(uint8_t i = 0; i < kMatrixWidth; i++) {
for(uint8_t j = 0; j < kMatrixHeight; j++) {
uint8_t color1 = noise[0][i][j];
uint8_t color2 = noise[0][j][i];
CRGB pixel;
if (color1 > border) {
pixel = ColorFromPalette( currentPalette, colorrepeat * (color1 + colorshift), color2 );
}
else {
pixel = ColorFromPalette( currentPalette, colorrepeat * (color2 + colorshift + 128), color1 );
}
leds[XY(i,j)] = pixel;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment