pattern

xod-dev/ws2812/pattern

Adds new colors to the tail of a given pattern.
pattern
@/pattern
Adds new colors to the tail of a given pattern.
PAT@/color-pattern
The pattern to extend. Leave empty to create a new pattern.
Cxod/color/color (variadic)
The color to add.
pattern
PAT
C
PAT'
PAT'@/color-pattern
The resulting pattern.
To use the node in your project you should have the xod-dev/ws2812 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#include <XColorPattern.h>

node {
    PatternNode node;

    void evaluate(Context ctx) {
        auto pattern = getValue<input_PAT>(ctx);
        auto color = getValue<input_C>(ctx);

        if (isInputDirty<input_C>(ctx)) {
            node.setColor(color);
        }
        if (isSettingUp()) {
            pattern->add(&node);
        }

        emitValue<output_PATU0027>(ctx, pattern);
    }
}