@ -105,27 +105,28 @@ cRGB Haunt::compute(uint8_t *step) {
// BlazingTrail
// BlazingTrail
BlazingTrail : : BlazingTrail ( void ) {
BlazingTrail : : BlazingTrail ( void ) {
}
}
uint8_t hue_start = 50.0 / 360 * 0xff ;
uint8_t hue_end = 0 ;
cRGB BlazingTrail : : compute ( uint8_t * step ) {
cRGB BlazingTrail : : compute ( uint8_t * step ) {
cRGB color ;
cRGB color ;
if ( * step > = 0xff - 30 ) {
// Get a float from 0 to 1 for our position in the animation
color = hsvToRgb ( 0xff - * step , 255 , 255 ) ;
float pos = ( 0xff - * step ) / ( float ) 0xff ;
} else {
color = hsvToRgb ( 30 , 255 , 255 ) ;
color . r = min ( * step * color . r / 255 , 255 ) ;
// Fade hue linearly from orange to red
color . g = min ( * step * color . g / 255 , 255 ) ;
uint8_t hue = hue_start + pos * ( hue_end - hue_start ) ;
}
if ( * step > = 0xff - 30 )
// Fade value from full following a -x^4+1 curve
* step - = 1 ;
uint8_t val = 0xff * ( 1 - pos * pos * pos * pos ) ;
else if ( * step > = 0x40 )
* step - = 16 ;
color = hsvToRgb ( hue , 0xff , val ) ;
else if ( * step > = 32 )
* step - = 32 ;
if ( * step < 4 ) {
else
* step = 0 ;
* step = 0 ;
} else {
* step - = 4 ;
}
return color ;
return color ;
}
}