Skip to content

Very slow fade #409

Closed
Closed

Description

@bbtimx

Hello,

I want to code an very slow fade animation with and without noise.

I have these functions:

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{    
    for( int led = 0; led < NUM_LEDS; led++) {
        leds[led] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
        colorIndex += 3;
    }
}

and

void fillnoise8_2() {  
  for(int i = 0; i < NUM_LEDS; i++) {
    int ioffset = scale * i;
      
    uint8_t data = inoise8(x + ioffset,z);

    data = qsub8(data,16);
    data = qadd8(data,scale8(data,39));
    uint8_t olddata = noise[i];
    uint8_t newdata = scale8( olddata, speed) + scale8( data, 256 - speed);
    data = newdata;
    
    noise[i] = data;
  }
  
  z += speed ;
  x += speed / 4;
}

void mapNoiseToLEDsUsingPalette()
{  
  uint8_t index;
    
  for(int i = 0; i < NUM_LEDS; i++) {

    index = noise[i];

    CRGB color = ColorFromPalette( currentPalette, index, brightness, currentBlending );
    leds[i] = color;
  }
  
  index += 1;
}

The settings are:

currentPalette = OceanColors_p;   
currentBlending = LINEARBLEND;
speed = 3;
scale = 20;

With set the speed to 1 its even to fast fade.

I play in the loop function with something like this:

EVERY_N_MILLISECONDS(10){
  fillnoise8_2();
  mapNoiseToLEDsUsingPalette();
}

but this makes the fade like steps.

How can I make the fade very slow?

Activity

  1. jasoncoon commented on Feb 10, 2017

    @jasoncoon
    Member

    The Issues list is for reporting bugs with the FastLED library. You'll likely have better luck getting help with this on the FastLED community on G+: https://plus.google.com/u/0/communities/109127054924227823508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions