Cross-fading

Adjusting the transition time between two expressions

When introducing a new expression, Punctual always waits to the start of the next cycle to execute it. At that point, a transition occurs between the last expression and the new one. By default, this transition is quite fast, but the duration of the fade from one expression to another is adjustable.

<>

To control the transition time, you can use the <> operator at the end of the expression:

[1,0,0] >> add <> 2;

By default, the time is in seconds, so in this example, the expression will fade for two seconds. Alternatively, you can write the unit to be used, such as s for seconds, ms for milliseconds, or c for cycles.

[0,1,0] >> add <> 1.5c;
[0,0,1] >> add <> 3500ms;

It’s important to note that specifying 0 for cross-fading will result in an instantaneous change at the beginning of the next cycle.

Interestingly, Punctual accepts negative numbers for the transition time, and depending on the specified time, it causes a transition from the new pattern back to the old one.

When using multiple output notations, each expression will fade at its own pace:

[fx>0,0,0] >> add <> 2c;
[fx<0,0,0] >> add <> 0.5c;

In this example, the first expression will fade over a duration of 2 cycles (2c), while the second expression will have a quicker fade lasting 0.5 cycles (0.5c). This flexibility allows for distinct transition times between different visual elements.

Lastly, it’s worth mentioning that the zero function can be very useful for fading out a pattern, especially towards the end of a performance. You can use zero $ before any pattern, set a time for the transition, and gradually fade out the current pattern to black.