afterglow.effects.color

Effects pipeline functions for working with color assignments to fixtures and heads.

build-htp-color-assigner

(build-htp-color-assigner head param show snapshot)

Returns an assigner that applies highest-takes-precedence color mixing of a dynamic color parameter to the supplied head or fixture. If the parameter is not frame-dynamic, it gets resolved when creating this assigner. Otherwise, resolution is deferred to frame rendering time. At that time, both the previous assignment and the current parameter are resolved, and the red, green, and blue values of the color are set to whichever of the previous and current assignment held the highest.

build-htp-color-assigners

(build-htp-color-assigners heads param show)

Returns a list of assigners which apply highest-takes-precedence color mixing to all the supplied heads or fixtures.

build-saturation-transformation

(build-saturation-transformation & {:keys [param], :or {param (osc/build-oscillated-param (osc/sawtooth :down? true) :max 100)}})

Creates a color transformation for use with transform-colors which changes the saturation based on a variable parameter. If no parameter is supplied, the default is to use an oscillated parameter based on sawtooth-beat with :down? set to true so the color is fully saturated at the start of the beat, and fully desaturated by the end. A different pattern can be created by supplying a different parameter with the :param optional keyword argument.

color-effect

(color-effect name color fixtures & {:keys [include-color-wheels? htp?]})

Returns an effect which assigns a color parameter to all heads of the fixtures supplied when invoked. If :include-color-wheels? is passed with a true value, then fixtures which use color wheels are included, otherwise only color-mixing fixtures are included. If :htp? is passed with a true value, highest-takes-precedence assignment is used with the red, green, and blue color values to blend this color with any previous color that might have been assigned to the affected fixtures.

fade-colors

(fade-colors from to fraction show snapshot target)

Calculate a weighted HSL blend between two colors, which may be dynamic parameters, and where nil is considered to be a fully darkened version of the other side of the fade.

htp-merge

(htp-merge previous current)

Helper function for assigners that want to use highest-takes-priority blending for RGB colors. Returns a color that contains the highest red component from the two input colors, the highest green component, and the highest blue component.

transform-colors

(transform-colors fixtures & {:keys [transform-fn beyond-server], :or {transform-fn (build-saturation-transformation), beyond-server nil}})

Creates an effect which modifies any effect that is currently assigning a color to the supplied fixtures. Needs to be assigned a higher priority than any effects it should transform, so that it will run after them. The actual transformation is implemented by a function which takes a color, show, snapshot, and head, and returns a transformed color. This function is specified with the :transform-fn optional keyword argument; if none is specified, build-saturation-transformation is called with no arguments to create one which causes the saturation of the color to range from full at the start of each beat to none at the end.

If the optional keyword argument :beyond-server is passed with a Beyond server (as returned by beyond-server), any color being sent to that integrated laser show using laser-color-effect will also be transformed.