On my Twitch stream, you can type commands in chat to run custom lightshow code.
Community member yugecin26 has made a fairly accurate emulator for the light code described below. You can use it to test light code before putting it in chat!
I have 2 LED strips with 180 RGB pixels each. They always run its animations at 30 FPS.
- Added time range syntax:
(#f00 +500ms-1s)
- Added ability to have multiple animators per operator:
(#f00 -> #0f0 -> #00f)
- Added support for more than 2 colors in gradients:
(#f00-#0f0-#00f)
- Added support for beat-synchronized time durations:
(#f00 ->1x #000)
- Added support for decimals in time durations:
(#f00 ->.2s #000)
- Added ability to specify strip flags in statements:
(:L #f00) (:R #00f)
Here's a few examples:
- Fill entire strip:
(#F00)
- Fill entire strip with a gradient:
(#F00-#0F0)
- Fill entire strip with a gradient with multiple colors:
(#F00-#0F0-#00F-#FF0-#0FF-#F0F)
- Paint single pixel at offset 100:
(@100, #F00)
- Paint range of pixels:
(@100-180, #F00)
- Paint range of pixels with a gradient:
(@100-180, #F00-#0F0)
- Fade from red to blue pixels in 2 seconds in a range of pixels:
(@100-180, #F00 ->2s #00F)
- Fade from red to blue pixels in 2 seconds while also moving and resizing the pixel range for 1 second:
(@100-180 -> @120-130, #F00 ->2s #00F)
Properties of a statement can be animated. The syntax for this is an arrow ->
and can appear in statements multiple times. For example:
- Animate from red to blue in 1 second:
(#f00 -> #00f)
- Animate from red to blue in 2.5 seconds:
(#f00 ->2.5s #00f)
- Animate from red to blue in 2 seconds after 3 seconds:
(#f00 3s->2s #00f)
- Flip a gradient over 5 seconds:
(#f00-#00f ->5s #00f-#f00)
- Move range of pixels over time
(@0-90 -> @91-180)
- Move range of red pixels back and forth
(#f00 @100-120 ->500ms @20-40 ->500ms @100-120)
You can chain multiple statements together. For example, you can fill 2 halves of all pixels like this:
(@0-90, #f00) (@90-180, #00f)
You can make a statement show up during a specific time range using the +
operator. For example:
- Flash the bottom red for 500ms, flash the top blue for 500ms:
:loop (@0-90, #f00 +0ms-500ms) (@91-180, #00f +500ms)
- Flash green red and blue stripes downwards at different times:
:loop (@160-180 ->200ms @0-20, #f00 +0ms-200ms) (@160-180 ->200ms @0-20, #0f0 +200ms-400ms) (@160-180 ->200ms @0-20, #00f +400ms-600ms)
Any time in the syntax is formed from a decimal number (for example 1
, .5
, 2.5
, or 500
) and a unit. The following units are supported:
s
Secondsms
Millisecondsx
Beat multiplier: this is synchronized to the beat. For example,1x
is one beat long,.5x
is half a beat,2x
is 2 beats
You can also specify flags at the beginning of your command. For example, to specify the beat
flag:
:beat (#fff ->300ms #000)
The available flags are:
beat
Restart the light code on the beat.loop
Loop the light code.
Statements also have flags. Currently they only allow you to pick which LED strip is being rendered to. For example, to render the left strip red and the right strip blue:
(:L #f00) (:R #00f)
The available flags are l
(same as L
) and r
(same as R
).