#pragma once #include #include #include #include "ColorPalettes.h" #include "PWM_Output.h" #include "system.h" #define MinLoopDelay 2 #define MaxLoopDelay 200 #define MaxSpeed 100 #define RANDOM_DECAY true #define LINEAR_DECAY false #define CYCLES_PER_DIRECTION 2 #define FIRE_COOLING 55 #define FIRE_SPARKING 120 #define FIRE_brightness 240 struct ANIM_FIRE { int speed; uint8_t cooling = FIRE_COOLING; // How much does the fire cool as it rises. Less cooling = taller flames. Default 55, suggested range 20-100 uint8_t sparking = FIRE_SPARKING; // What chance (out of 255) is there that a new spark will be lit. Higher chance = more roaring fire. Default 120, suggested range 50-200 uint8_t brightness = FIRE_brightness; // Overall brightness of the fire effect. Default 240, suggested range 50-255 }; extern ANIM_FIRE fireSettings; struct ANIM_COMET { int speed; int minFade; int maxFade; float sizeFactor; int cycles; int count; }; extern ANIM_COMET cometSettings; struct ANIM_SNAKES{ int speed; int cycles; int multiplier; }; extern ANIM_SNAKES snakeSettings; void Animation_Init(void); void Animation_Loop(bool volatile& loop_active_flag, int speed, std::function callback); void Animation_Loop_Limited(bool volatile& loop_active_flag, int speed, TickType_t duration, std::function callback); void Animation_Loop_Cycles(bool volatile& loop_active_flag, int speed, uint32_t loop_cycles, std::function callback); void Anim_Rainbow(bool volatile& loop_active_flag, CRGB* leds, int size, int speed); void Anim_Fire(bool volatile& activeFlag, CRGB* leds, int size, int speed, const CRGBPalette16& firePalette, int shift); void Anim_Color_Sectors(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colorPack, bool gaps, uint8_t numRepeats, int minSpeed, int maxSpeed) ; //template //void Anim_Color_Gradient_Trans(bool volatile& activeFlag, CRGB* leds, int size, TPalette& palette, uint8_t paletteSize, uint8_t numRepeats, int speed); //void Anim_Color_Gradient_Red_Yellow_Violet(bool volatile& activeFlag, CRGB* leds, int size, int speed); void Anim_Comets(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colorPack, int minSpeed, int maxSpeed, bool randomDecay, int cometMultiplier = 1); //void Anim_Comet_Rainbow(bool volatile& activeFlag, CRGB* leds, int size, int speed); void Anim_TimedFill(bool volatile& activeFlag, CRGB* leds, int size, CRGB col1, CRGB col2, int totalDurationMs, int shift); void Anim_TimedFill_Flash(bool volatile& activeFlag, CRGB* leds, int size, PWM_Output* pwmOut, RAMP_LIGHT_SETTINGS* pwmSettings, int pwmOutDelay, int flashTimeout, CRGB baseCol, CRGB fillCol, int totalDurationMs, int shift = 0); void Anim_ColorBreath(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colors, uint32_t timeMs, int speed); void Anim_Sparkle(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colors, int speed, uint8_t sparkleChance); void Anim_GradientRotate(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colors, int speed); void Anim_SolidWhite(bool volatile& activeFlag, CRGB* leds, PWM_Output* pwmOut, int size, int brightness, int timeoutMs = -1); void Anim_Roating_Snakes(bool volatile& activeFlag, CRGB* leds, const COLOR_PACK& colorPack, int brightness); void Anim_Snakes(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colorPack, int speed, int multiplier = 1); void Anim_Birds(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colorPack, int speed , int multiplier = 1); void Anim_Morph(bool volatile& activeFlag, CRGB* leds, int size, const COLOR_PACK& colorPack, int speed , int morphSteps); uint32_t getRandomValue(uint32_t maxValue);