Hello, pretty new to FastLED and I'm sure this is a simple question,

Hello, pretty new to FastLED and I’m sure this is a simple question, but I haven’t been able to find the answer so far. Is there a way to fade in - like the fadetoblackby function, but for fading in? I would like to do something like the Cylon sketch except have the leading edge fade in instead of coming on full and fading. Thanks in advance.

I am so excited by all the different projects I’ve seen in this group so far! I can’t wait to do a bunch of these!

There isn’t a “fade in” function. You will need to roll your own in code.

You can use fadeToBlackBy on a specific pixel like this though:
leds[i].fadeToBlackBy(64); //fade by 25%

Thanks, Marc! Looking at this sketch, it looks like the fadeLightBy function can fade up and down. I will give it a try. https://codebender.cc/sketch:86106#FadePulseGlow.ino

fadeToBlackBy is not actually making the pixels get brighter though. The pixels always start out at max brightness and then are being fade more and more (creating a dimming effect), or faded from maximum fade to less and less fade (creating a brightening effect). It’s a good trick and looks like it should work well! Ultimately it doesn’t matter how things are accomplished under the hood, only that you’re happy with the displayed visual. :slight_smile:

fadeToBlack isn’t designed to “fade up” because it doesn’t know anything about where it should end up. In other words if it starts at black, CRGB(0,0,0), it has no idea what values it should increase up to and stop at.

Instead of using CRGB I typically use CHSV, making it easy to animate the V (Value) part to ramp brightness up (or down).

Using color palettes would be another way to animated a fade in. The palette can go from black to whatever color you want to fade up to.