matrix lava

sample animation for matrix 10x10 simulator

This animation uses 7 threads: 1 for launch and 6 for the lava background.

 Loading animation...

Glowscript:

// DEVICE (modify with care)

 

    // Matrix simulator

    device: name = 'simulator-matrix-10x10'

    device: type = 'sim'

    device: tickIntervalMillisecs = '100'    // increase to reduce CPU load.

    device: protocolVersion = '1.0'

    device: ledCount = '100'

    device: ramSpaceBytes = '25000'          // set an animation size limit in memory.

    device: romSpaceBytes = '200000'         // set an animation size limit on disk.

 

// DEFINES (modify as needed)

 

    // LED defines:

    define: ring1Leds = '[45,46,55,56]'

    define: ring2Leds = '[34-37,44,47,54,57,64-67]'

    define: ring3Leds = '[23-28,33,38,43,48,53,58,63,68,73-78]'

    define: ring4Leds = '[12-19,22,29,32,39,42,49,52,59,62,69,72,79,82-89]'

    define: ring5Leds = '[1-11,20,21,30,31,40,41,50,51,60,61,70,71,80,81,90-100]'

    define: allLeds = '[1-100]'

 

    // Color defines:

    define: red = '(255,0,0,1)'

    define: green = '(0,255,0,1)'

    define: blue = '(0,0,255,1)'

    define: yellow = '(127,128,0,1)'

    define: orange = '(155,100,0,1)'

    define: purple = '(127,0,128,1)'

    define: off = '(0,0,0,1)'

 

// CODE

 

// Asynchronously launches 1 function then exits.

@start                        // mandatory function name for code launch.

    callAsync: @funcLava      // launch function asynchronously.

 

// Asynchronously launches 5 functions at staggered intervals then exits.

@funcLava

    glowRamp: allLeds off to red in 800ms    // transition led(s) color.

    callAsync: @funcLavaRing1                // launch function asynchronously.

    pause: 300ms                             // tickIntervalMillisecs multiple (3 * 50ms => 150ms).

    callAsync: @funcLavaRing2

    pause: 300ms

    callAsync: @funcLavaRing3

    pause: 300ms

    callAsync: @funcLavaRing4

    pause: 300ms

    callAsync: @funcLavaRing5

 

// Continuously cycles ring1 colors.

@funcLavaRing1

    here: start_tag                               // set bookmark.

    glowRamp: ring1Leds red to orange in 2s       // transition led(s) color.

    glowRamp: ring1Leds orange to yellow in 2s

    glowRamp: ring1Leds yellow to green in 2s

    glowRamp: ring1Leds green to blue in 2s

    glowRamp: ring1Leds blue to purple in 2s

    glowRamp: ring1Leds purple to red in 2s

    goto: start_tag                               // loop back to bookmark.

 

// Continuously cycles ring2 colors.

@funcLavaRing2

    here: start_tag                               // set bookmark.

    glowRamp: ring2Leds red to orange in 2s       // transition led(s) color.

    glowRamp: ring2Leds orange to yellow in 2s

    glowRamp: ring2Leds yellow to green in 2s

    glowRamp: ring2Leds green to blue in 2s

    glowRamp: ring2Leds blue to purple in 2s

    glowRamp: ring2Leds purple to red in 2s

    goto: start_tag                               // loop back to bookmark.

 

// Continuously cycles ring3 colors.

@funcLavaRing3

    here: start_tag                               // set bookmark.

    glowRamp: ring3Leds red to orange in 2s       // transition led(s) color.

    glowRamp: ring3Leds orange to yellow in 2s

    glowRamp: ring3Leds yellow to green in 2s

    glowRamp: ring3Leds green to blue in 2s

    glowRamp: ring3Leds blue to purple in 2s

    glowRamp: ring3Leds purple to red in 2s

    goto: start_tag                               // loop back to bookmark.

 

// Continuously cycles ring4 colors.

@funcLavaRing4

    here: start_tag                               // set bookmark.

    glowRamp: ring4Leds red to orange in 2s       // transition led(s) color.

    glowRamp: ring4Leds orange to yellow in 2s

    glowRamp: ring4Leds yellow to green in 2s

    glowRamp: ring4Leds green to blue in 2s

    glowRamp: ring4Leds blue to purple in 2s

    glowRamp: ring4Leds purple to red in 2s

    goto: start_tag                               // loop back to bookmark.

 

// Continuously cycles ring5 colors.

@funcLavaRing5

    here: start_tag                               // set bookmark.

    glowRamp: ring5Leds red to orange in 2s       // transition led(s) color.

    glowRamp: ring5Leds orange to yellow in 2s

    glowRamp: ring5Leds yellow to green in 2s

    glowRamp: ring5Leds green to blue in 2s

    glowRamp: ring5Leds blue to purple in 2s

    glowRamp: ring5Leds purple to red in 2s

    goto: start_tag                               // loop back to bookmark.