afterglow.effects.fun

A collection of neat effects that are both useful in shows, and examples of how to create such things.

adjust-strobe

(adjust-strobe)

An auxiliary effect which creates no assigners to directly affect lights, but adjusts show variables used by the strobe effect. It is designed to be run as a parallel cue to offer the user controls for adjusting the hue and saturation of any active strobes.

aim-fan

(aim-fan fixtures & {:keys [x y z x-scale y-scale effect-name], :or {x 0.0, y 0.0, z 5.0, x-scale 1.0, y-scale 1.0, effect-name "Aim Fan"}})

Creates an aim effect which aims the lights outward around a reference point specified by :x, :y, and :z, which defaults to (0, 0, 5), by first aiming the lights at the reference point, and then adding on the distance within the x-y plane from the fixture to that point, multiplied by :x-scale and :y-scale, which each default to 1. A scale of 0 would aim the lights straight forward. Positive values fan them out, while negative values overshoot the reference point in the other direction, fanning them in. All parameters other than fixtures can be dynamic or keywords, which will be bound to show variables.

You can override the default effect name of Aim Fan by passing in another with :effect-name.

bloom

(bloom fixtures & {:keys [color fraction measure], :or {color (colors/create-color :white), fraction 0, measure (transform/build-distance-measure 0 0 0)}})

An effect which causes a color (which defaults to white) to spread from a point across a set of lights, controlled by a fraction from 0 to 1. The spread is defined by a distance measure (as created by build-distance-measure), which defaults to a sphere starting at the origin. For efficiency, the measure cannot be frame dynamic, and is evaluated when the effect is created.

color-cycle-chase

(color-cycle-chase fixtures measure & {:keys [color-cycle color-index-function transition-phase-function effect-name], :or {color-cycle default-color-cycle, color-index-function rhythm/snapshot-bar-within-phrase, transition-phase-function transition-during-down-beat, effect-name "Phrase Color Cycle"}})

Returns an effect which moves through a color cycle over a period of time (by default changing each bar of a phrase), performing a transition as a new color is introduced, using the specified distance measure to determine when each light starts to participate. By default the transition occurs over the down beat (first beat) of the bar. See below for how these defaults can be changed.

The distance measure supplied as the second argument is a function which accepts a fixture or head and returns a nonnegative value which controls the point during the transition when that head will change from the old color to the new color. A fixture returning a value of 0 will change as soon as transition has started, and the fixture(s) that return the largest value will change when the transition ends. A value halfway between zero and the largest value would mean the color of that fixture or head would change exactly at the midpoint of the transition. Many interesting looking transtitions can be created using distance measures constructed by calling afterglow.transform/build-distance-measure, as is done by iris-out-color-cycle-chase and several examples which follow it. There are lots of other kinds of functions which can created, though; at the opposite extreme you can do completely arbitrary things like assigning each head a random “distance” when the effect is created.

The sequence of colors which are cycled through can be changed by passing in a vector with :color-cycle. Each value in the vector can either be a color object, or a dynamic parameter which resolves to a color object when the effect is running. As ususal, you can bind to show variables containing a color by passing the variable names as keywords within the vector.

When the effect is being rendered, the current color index within :color-cycle is determined by calling a function with the snapshot obtained from the show metronome at the start of the rendering frame. The default function, afterglow.rhythm/snapshot-bar-within-phrase, will assign a different color for each bar of a phrase. (If there are not enough colors in :color-cycle the cycle is repeated as necessary.) You can pass another index function with :color-index-function to change how and when the cycle is traversed.

The function supplied with :transition-phase-function determines precisely when the transition takes place and how quickly it occurs. It is also called with the show metronome snapshot, and if the value it returns is less than zero, the transition is considered not to have started yet, and no fixtures will be assigned the current color. Values between zero and one mean the transition is in progress, and lights whose distance measure divided by the largest distance measure is less than or equal to the current phase will change color. Once the transition phase reaches one (or greater), the transition is complete, and all lights will be assigned the color associated with the current cycle index. The default transition phase function, transition-during-down-beat, causes the transition to be spread over the down beat of each bar. Passing rhythm/snapshot-bar-phase instead would spread the transition over the entire bar, so that transitions would be feeding right into each other. Other possibilities are limited only by your imagination. The transition can run backwards; it can pause or reverse directions multiple times; it does not even necessarily have to happen only once during each index value. This means that if you want to reverse the direction of a transition which lasts for the entire duration of a cycle index value, you can do it by reversing either the distance measure or the phase function, whichever is easier. (If the transition is shorter than the time over which the :color-index-function changes, you will want to reverse the distance measure rather than the phase function, because otherwise the order in which the colors appear will be strange.)

To give your running effect a meaningful name within user interfaces, pass a short and descriptive value with :effect-name.

confetti

(confetti fixtures & {:keys [step min-added max-added min-duration max-duration min-saturation aim? min-x max-x min-y max-y min-z max-z], :or {min-x -5.0, aim? false, step (params/build-step-param), max-z 5.0, min-saturation 100.0, min-added 1, min-z 0.5, max-added 4, max-x 5.0, min-y 0.0, min-duration 2, max-duration 4, max-y 0.0}})

A random color effect, which assigns a new random color to a random selection of the supplied fixture heads each time a step parameter changes value. That color lasts a random number of steps.

The step parameter defaults to one which changes each beat, buy you can supply your own with the optional keyword argument :step. Its value will be rounded to the nearest integer when checking for changes, so fades are ignored.

The minimum and maximum number of heads to assign colors on each step default to 1 and 4, and can be adjusted with :min-added and :max-added. The minimum and maximum number of steps that each assignment will last default to 4 and 8, and can be adjusted with :min-duration and :max-duration.

By default, colors chosen are always fully saturated, but you can pass a percentage with :min-saturation and a random saturation value between that and 100% will be chosen for each head.

When generating a new set of confetti flakes, if more than one head is chosen, they will all be assigned a color of the same hue, but may each get individual random saturations. The duration of the flake on each head will also be individually randomly assigned.

In addition to assigning colors, flakes can also aim the lights at a particular point. To activate this, pass a true value with :aim?. By default the aiming points will be randomly generated to be on the floor from half a meter to five meters in front of the rig, and with x values ranging from -5 to 5 meters, but you can adjust the space from which they are chosen by passing values with :min-x, :max-x, :min-y, :max-y, :min-z, and max-z.

All parameters after fixtures may be dynamic, including show variables with the standard shorthand of passing the variable name as a keyword. Since step, :min-added, :max-added, aim?, and the boundaries of the aiming space are not associated with a specific head, they cannot be spatial parameters. The other parameters can be, however, so saturations and durations can vary over the ligthing rig.

default-color-cycle

The default list of colors to cycle through for the color-cycle-chase.

default-down-beat-color

The default color for metronome-effect to flash on the down beats.

default-other-beat-color

The default color for metronome-effect to flash on beats that are not down beats.

default-pinstripe-colors

The set of colors that will be used by a pinstripe effect if no :colors parameter is supplied.

default-sparkle-color

The default color for the sparkle effect.

dimmer-sparkle

(dimmer-sparkle fixtures & {:keys [chance fade-time master include-rgb-fixtures?], :or {chance 0.001, fade-time 500, master (:grand-master *show*), include-rgb-fixtures? false}})

A variation of the sparkle effect which uses dimmer channels, instead of RGB color mixing, for fixtures that lack such capability. Note that some fixtures may have dimmers that do not respond quickly enough for this to work well; you will have to try it and see.

As each frame of DMX values generated, each participating fixture head has a chance of being assigned a sparkle (this chance is controlled by the optional keyword parameter :chance). Once a sparkle has been created, it will fade out over the number of milliseconds specified by the optional keyword parameter :fade-time.

As with other dimmer effects, the maximum level to which the dimmer can be set is limited by a dimmer master chain. You can pass one in explicitly with :master. If you do not, the show’s grand master is used.

By default this effect ignores fixtures that can perform RGB color mixing, because you are better off using the regular sparkle effect with them. But if for some reason you want it to affect their dimmers as well, you can pass a true value with :include-rgb-fixtures?.

iris-out-color-cycle-chase

(iris-out-color-cycle-chase fixtures & {:keys [center color-cycle color-index-function transition-phase-function effect-name], :or {color-cycle default-color-cycle, color-index-function rhythm/snapshot-bar-within-phrase, transition-phase-function transition-during-down-beat, effect-name "Iris Out"}})

Returns an effect which changes the color of a group of fixture heads on the down beat of each bar of a phrase, expanding the color from the center of the show x-y plane outwards during the down beat.

Unless otherwise specified by passing an explicit pair of x and y coordinates with :center (e.g. :center [0.0 0.0]), the starting point of the transition will be the x-y center of the bounding box of the fixtures participating in it (the smallest box containing all of their heads).

You can change the colors used, and when transitions occur, by overriding the default values associated with the optional keyword arguments :color-cycle, :color-index-function, and :transition-phase-function. For details about how these are interpreted, see color-cycle-chase which is used to implement this chase.

metronome-effect

(metronome-effect fixtures & {:keys [down-beat-color other-beat-color metronome], :or {down-beat-color default-down-beat-color, other-beat-color default-other-beat-color, metronome (:metronome *show*)}})

Returns an effect which flashes the supplied fixtures to the beats of the show metronome, emphasizing the down beat, which is a great way to test and understand metronome synchronization. The color of the flashes can be controlled by the :down-beat-color and :other-beat-color optional keyword arguments (defaulting to red with lightness 70, and yellow with lightness 20, respectively).

This is no longer as useful as it used to be before there were metronome adjustment interfaces in the Ableton Push and then web interfaces, but is still an example of how to write a metronome driven effect, and can be synchronized to metronomes other than the default show metronome by passing them in with optional keyword argument :metronome.

pinstripes

(pinstripes fixtures & {:keys [step tolerance colors], :or {step (params/build-step-param), tolerance 0, colors default-pinstripe-colors}})

A color effect which divides the lights into alternating columns by their x positions (with configurable tolerance, defaulting to requiring exact equality), and assigns a color to each column. The colors rotate according to a step parameter.

The step parameter defaults to one which changes abruptly on each beat, but you can supply your own with the optional keyword argument :step. Fades between colors can be achieved by passing a step parameter that fades.

The tolerance used when grouping the heads into stripes is controlled by the optional parameter :tolerance, which defaults to zero, meaning the heads must have the exact same x value to get assigned to the same stripe. The assignment of heads into stripes is done when the effect is created, so if the tolerance changes after that, it will have no effect.

The colors themselves are passed as a sequence with :colors and default to red and white. The list of colors you supply can be of any length. Although the colors within the list themselves can be dynamic parameters, the conntent of the list is evaluated when the effect is created, so the number of colors and the color parameters themselves are fixed at that time.

The :step, :tolerance, and :colors parameters may be dynamic, (and may be bound to show variables using the standard shorthand of passing the variable name as a keyword). Since :step and :tolerance are not associated with a specific head, they cannot be a spatial parameters. The colors can be, however, so for example saturations can vary over the rig.

random-beat-number-param

(random-beat-number-param & {:keys [min max min-change], :or {min 0, max 255, min-change 0}})

Returns a dynamic number parameter which gets a new random value on each beat.

sparkle

(sparkle fixtures & {:keys [color chance fade-time], :or {color default-sparkle-color, chance 0.001, fade-time 500}})

A random sparkling effect like a particle generator over the supplied fixture heads.

As each frame of DMX values generated, each participating fixture head has a chance of being assigned a sparkle (this chance is controlled by the optional keyword parameter :chance). Once a sparkle has been created, it will fade out over the number of milliseconds specified by the optional keyword parameter :fade-time. The initial color of each sparkle can be changed with the optional keyword parameter :color. All parameters may be dynamic, including show variables with the standard shorthand of passing the variable name as a keyword.

strobe

(strobe name fixtures level lightness)

A compound effect which sets dimmers to the level determined by the show variable :strobe-dimmers (defaulting to 255), assigns a color based on the show variables :strobe-hue (with a default of 277, purple) :strobe-saturation (with a default of 100), and the specified lightness (which may be a dynamic parameter), with a default of 100, which would white out the hue until it was lowered. The effect then sets the fixtures’ strobe channel to the specified level, which may also be a dynamic parameter.

This is designed to be run as a high priority queue, ideally while held and with aftertouch adjusting a cue-introduced variable for level (which is used to control the strobe function of the affected fixtures, setting the strobe speed, and defaults to a middle value). The global strobe color can be adjusted via the show variables, either by aftertouch or by another effect with no assigners, like adjust-strobe.

strobe-2

(strobe-2 name fixtures level lightness)

An updated version of strobe which takes advantage of the new ability to use color variables with rich user interfaces on the web and Ableton Push. A compound effect which sets dimmers to the level determined by the show variable :strobe-dimmers (defaulting to 255), assigns a color based on the show variable :strobe-color (with a default of a fully-saturated purple), and the specified lightness (which may be a dynamic parameter), with a default of 100, which would white out the hue until it was lowered. The effect then sets the fixtures’ strobe channel to the specified level, which may also be a dynamic parameter.

This is designed to be run as a high priority queue, ideally while held and with aftertouch adjusting a cue-introduced variable for level (which is used to control the strobe function of the affected fixtures, setting the strobe speed, and defaults to a middle value). The global strobe color can be adjusted via the show variables, either by aftertouch or by another effect with no assigners, like adjust-strobe.

transition-during-down-beat

(transition-during-down-beat snapshot)

A transition phase function which causes the color cycle transition to occur during the down beat of each bar. See color-cycle-chase for how this is used.

twirl

(twirl fixtures & {:keys [x y z radius beats cycles effect-name], :or {x 0.0, y 0.0, z -2.0, radius 0.25, beats 4, cycles 1, effect-name "Twirl"}})

Creates a direction movement effect which aims the lights outward from a point specified by :x, :y, and :z, which defaults to (0, 0, -2), then displaces the front of that vector by a distance of :radius in the x-y plane (defaulting to 0.25) in a direction which rotates around the plane driven by a sawtooth oscillator which defaults to a complete revolution every four beats, but whose beat ratio can be adjusted by the parameters :beats and :cycles, and whose phase is spread across the x axis as a spatial parameter over all fixtures. All parameters other than fixtures can be dynamic or keywords, which will be bound to show variables.

You can override the default effect name of Twirl by passing in another with :effect-name.

wipe-right-color-cycle-chase

(wipe-right-color-cycle-chase fixtures & {:keys [color-cycle color-index-function transition-phase-function effect-name], :or {color-cycle default-color-cycle, color-index-function rhythm/snapshot-bar-within-phrase, transition-phase-function transition-during-down-beat, effect-name "Wipe Right"}})

Returns an effect which changes color on the down beat of each bar of a phrase, wiping the color from left to right across the show x axis.

You can change the colors used, and when transitions occur, by overriding the default values associated with the optional keyword arguments :color-cycle, :color-index-function, and :transition-phase-function. For details about how these are interpreted, see color-cycle-chase which is used to implement this chase.