Skip to content

Commit

Permalink
Plasma animation added
Browse files Browse the repository at this point in the history
  • Loading branch information
bportaluri committed Feb 10, 2018
1 parent cda0b26 commit 1c6a705
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ALA_FADEIN LITERAL1
ALA_FADEOUT LITERAL1
ALA_FADEINOUT LITERAL1
ALA_GLOW LITERAL1
ALA_PLASMA LITERAL1

ALA_FIRE LITERAL1
ALA_BOUNCINGBALLS LITERAL1
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ALA
version=2.3.4
version=2.3.5
author=bportaluri
maintainer=Bruno Portaluri <bportaluri@gmail.com>
sentence=Arduino Light Animation (ALA) library
Expand Down
1 change: 1 addition & 0 deletions src/Ala.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ along with The Arduino ALA library. If not, see
#define ALA_FADEOUT 302
#define ALA_FADEINOUT 303
#define ALA_GLOW 304
#define ALA_PLASMA 305

#define ALA_FADECOLORS 351
#define ALA_FADECOLORSLOOP 352
Expand Down
13 changes: 13 additions & 0 deletions src/AlaLedRgb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ void AlaLedRgb::setAnimationFunc(int animation)
case ALA_FADEOUT: animFunc = &AlaLedRgb::fadeOut; break;
case ALA_FADEINOUT: animFunc = &AlaLedRgb::fadeInOut; break;
case ALA_GLOW: animFunc = &AlaLedRgb::glow; break;
case ALA_PLASMA: animFunc = &AlaLedRgb::plasma; break;
case ALA_PIXELSFADECOLORS: animFunc = &AlaLedRgb::pixelsFadeColors; break;
case ALA_FADECOLORS: animFunc = &AlaLedRgb::fadeColors; break;
case ALA_FADECOLORSLOOP: animFunc = &AlaLedRgb::fadeColorsLoop; break;
Expand Down Expand Up @@ -547,6 +548,18 @@ void AlaLedRgb::glow()
}
}

void AlaLedRgb::plasma()
{
float t = getStepFloat(animStartTime, speed, numLeds);

for(int x=0; x<numLeds; x++)
{
AlaColor c1 = palette.getPalColor((float)((x+t)*palette.numColors)/numLeds);
AlaColor c2 = palette.getPalColor((float)((2*x-t+numLeds)*palette.numColors)/numLeds);
leds[x] = c1.interpolate(c2, 0.5);
}
}


void AlaLedRgb::fadeColors()
{
Expand Down
1 change: 1 addition & 0 deletions src/AlaLedRgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class AlaLedRgb
void fadeOut();
void fadeInOut();
void glow();
void plasma();
void fadeColors();
void pixelsFadeColors();
void fadeColorsLoop();
Expand Down

0 comments on commit 1c6a705

Please # to comment.