I love to play with tail effects based on leds[i].nscale(); Problem: What to do,

I love to play with tail effects based on leds[i].nscale();
Problem: What to do, if the result of leds[i].nscale(254); gets already to dark because of high framerates (= many interations)?

Ok, found a work arround: Scale down only every 4th frame.

yeah: http://www.youtube.com/watch?v=lG8zYfc3TeE&feature=youtu.be

Great solution!

Also: cool effect.

Also also: you could consider putting delay() or FastLED.delay() with a small number in it, or using some other method to reduce the number of updates.

One thing that I have done is something like this: have a routine that dims down every Nth pixel (eg 4th), starting with pixel number J. Each time through the loop I call my dimming function, but with successive Js, wrapping around at N.

So on loop 1 it would dim these pixels:
0 4 8 12 16 …
And on the next loop it would dim pixels
1 5 9 13 17…
Then
2 6 10 14 18…
Then
3 7 11 15 19…
And then back to the start.

The effect is that the strip dims down at 1/4 speed, but more evenly across the whole thing than dimming ALL the pixels every fourth loop. Also, spreading out the CPU work evenly makes e LED update rate more even from frame to frame.

Just an idea to play with!

The idea to just dimm several Pixels per frame I like very much!
Any versions of delays don’t work for me, because A) I spend a lot of time getting rid of them :wink: and B) all my timing is based on millis() - so the delay would interfere with the balace of the change of the vars and by that with the appearance of the effect itself.
My intention is to only manipulate the speed of an effect, while the smooth appearance stays untouched. Also to make it portable for different setups.

Another possible way to slow down the effect. A dirty secret of nScale is that nScale8(255,255) = 254. Which means doing a scaling by 255 would slow things down just a bit more for you :slight_smile:

Thanks for lifting the secret, Daniel! :slight_smile:

What’s nscale do? I suspect I’m doing things by hand (badly) which are built into the lib…

Check out https://github.com/FastLED/FastLED/wiki/Pixel-reference
under “Dimming and Brightening Colors”.

.nscale8( scalefactor ) is something you can do to ‘dim down’ an RGB color. The scalefactor is a byte (0…255), which controls how much dimming to apply. 0= complete black; 128=half dimmed; 200=slightly dimmed; 255=barely dimmed at all.

It modifies it’s “this” argument in place, so if you wanted to dim down ALL the LEDs by a little bit:

for(int j=0; j<NUM_LEDS; j++) {
leds[j].nscale8( 250 ); // slight dimming
}

It’s compact – and fast. There are a few variants described on the wiki page: https://github.com/FastLED/FastLED/wiki/Pixel-reference

Heh I was multiplying 8-bit values with a float.

leds[i] %= 192;

That’s damn cool. Pah, you people that can code are annoying :slight_smile: