spinner

sample animation for elektra simulator

This animation uses 21 threads: 1 for launch and 1 for each LED.

 Loading animation...

Glowscript:

// DEVICE (modify with care)

 

    // Elektra simulator

    device: name = 'simulator-elektra-20'

    device: type = 'sim'

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

    device: protocolVersion = '1.0'

    device: ledCount = '20'

    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: innerLed1 = '[1]'      // alias for first led in strip.

    define: innerLed2 = '[2]'

    define: innerLed3 = '[3]'

    define: innerLed4 = '[4]'

    define: outerLed1 = '[5]'

    define: outerLed2 = '[6]'

    define: outerLed3 = '[7]'

    define: outerLed4 = '[8]'

    define: outerLed5 = '[9]'

    define: outerLed6 = '[10]'

    define: outerLed7 = '[11]'

    define: outerLed8 = '[12]'

    define: edgeLed1 = '[13]'

    define: edgeLed2 = '[14]'

    define: edgeLed3 = '[15]'

    define: edgeLed4 = '[16]'

    define: edgeLed5 = '[17]'

    define: edgeLed6 = '[18]'

    define: edgeLed7 = '[19]'

    define: edgeLed8 = '[20]'

    define: innerLeds = '[1-4]'    // alias for inner-ring leds.

    define: outerLeds = '[5-12]'

    define: edgeLeds = '[13-20]'

    define: allLeds = '[1-20]'

 

    // Color defines:

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

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

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

    define: turquoise = '(0,10,10,1)'

    define: yellow = '(10,10,0,1)'

    define: white = '(4,4,4,1)'

    define: orange = '(30,10,0,1)'

    define: purple = '(10,0,10,1)'

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

 

// CODE

 

// Asynchronously launches 20 functions at staggered intervals in a continuous loop.

// Each loop cycle has an 800ms duration.

@start                             // mandatory entry-point function name.

    here: start_tag                // set bookmark.

    callAsync: @funcInnerLed3      // call function asynchronously.

    callAsync: @funcOuterLed1      // call function asynchronously.

    callAsync: @funcEdgeLed1       // call function asynchronously.

    pause: 100ms                   // pause for 100 milliseconds.

    callAsync: @funcOuterLed2

    callAsync: @funcEdgeLed2

    pause: 100ms

    callAsync: @funcInnerLed4

    callAsync: @funcOuterLed3

    callAsync: @funcEdgeLed3

    pause: 100ms

    callAsync: @funcOuterLed4

    callAsync: @funcEdgeLed4

    pause: 100ms

    callAsync: @funcInnerLed1

    callAsync: @funcOuterLed5

    callAsync: @funcEdgeLed5

    pause: 100ms

    callAsync: @funcOuterLed6

    callAsync: @funcEdgeLed6

    pause: 100ms

    callAsync: @funcInnerLed2

    callAsync: @funcOuterLed7

    callAsync: @funcEdgeLed7

    pause: 100ms

    callAsync: @funcOuterLed8

    callAsync: @funcEdgeLed8

    pause: 100ms

    goto: start_tag                // loop back to bookmark.

 

// Illuminates first LED in inner-ring then exits. LED is on for 750ms.

@funcInnerLed1

    glowRamp: innerLed1 white to white in 50ms    // leading sparkle.

    glowRamp: innerLed1 red to off in 700ms       // fade effect.

 

// Illuminates second LED in inner-ring then exits. LED is on for 750ms.

@funcInnerLed2

    glowRamp: innerLed2 white to white in 50ms    // leading sparkle.

    glowRamp: innerLed2 red to off in 700ms       // fade effect.

 

@funcInnerLed3

    glowRamp: innerLed3 white to white in 50ms

    glowRamp: innerLed3 red to off in 700ms

 

@funcInnerLed4

    glowRamp: innerLed4 white to white in 50ms

    glowRamp: innerLed4 red to off in 700ms

 

// Illuminates first LED in outer-ring then exits. LED is on for 750ms.

@funcOuterLed1

    glowRamp: outerLed1 white to white in 50ms    // leading sparkle.

    glowRamp: outerLed1 green to off in 700ms     // fade effect.

 

// Illuminates second LED in outer-ring then exits. LED is on for 750ms.

@funcOuterLed2

    glowRamp: outerLed2 white to white in 50ms    // leading sparkle.

    glowRamp: outerLed2 green to off in 700ms     // fade effect.

 

@funcOuterLed3

    glowRamp: outerLed3 white to white in 50ms

    glowRamp: outerLed3 green to off in 700ms

 

@funcOuterLed4

    glowRamp: outerLed4 white to white in 50ms

    glowRamp: outerLed4 green to off in 700ms

 

@funcOuterLed5

    glowRamp: outerLed5 white to white in 50ms

    glowRamp: outerLed5 green to off in 700ms

 

@funcOuterLed6

    glowRamp: outerLed6 white to white in 50ms

    glowRamp: outerLed6 green to off in 700ms

 

@funcOuterLed7

    glowRamp: outerLed7 white to white in 50ms

    glowRamp: outerLed7 green to off in 700ms

 

@funcOuterLed8

    glowRamp: outerLed8 white to white in 50ms

    glowRamp: outerLed8 green to off in 700ms

 

// Illuminates first LED in edge-ring then exits. LED is on for 750ms.

@funcEdgeLed1

    glowRamp: edgeLed1 white to white in 50ms     // leading sparkle.

    glowRamp: edgeLed1 blue to off in 700ms       // fade effect.

 

// Illuminates second LED in edge-ring then exits. LED is on for 750ms.

@funcEdgeLed2

    glowRamp: edgeLed2 white to white in 50ms     // leading sparkle.

    glowRamp: edgeLed2 blue to off in 700ms       // fade effect.

 

@funcEdgeLed3

    glowRamp: edgeLed3 white to white in 50ms

    glowRamp: edgeLed3 blue to off in 700ms

 

@funcEdgeLed4

    glowRamp: edgeLed4 white to white in 50ms

    glowRamp: edgeLed4 blue to off in 700ms

 

@funcEdgeLed5

    glowRamp: edgeLed5 white to white in 50ms

    glowRamp: edgeLed5 blue to off in 700ms

 

@funcEdgeLed6

    glowRamp: edgeLed6 white to white in 50ms

    glowRamp: edgeLed6 blue to off in 700ms

 

@funcEdgeLed7

    glowRamp: edgeLed7 white to white in 50ms

    glowRamp: edgeLed7 blue to off in 700ms

 

@funcEdgeLed8

    glowRamp: edgeLed8 white to white in 50ms

    glowRamp: edgeLed8 blue to off in 700ms