Spill: Modifying colours
If you want to increase or decrease the amount of color of a cell by a little bit, there are multiple ways you can go about it:
Anonymous callbacks
In the sequencing post, we saw that we can use hydra-like functions to change the colours of a cell. We used the syntax ()=><something>
, where <something>
was any expression:
$: cell("P")
.r(() => time%10);
What you might not know is that spill is passing the previous value of the parameter to the round parentheses. So, similar to some strudel functions like superimpose
, we can use it to get a new value based on the previous one:
$: cell("P")
.r((x) => x-1);
Relative mininotation
You can also transform the strudel mininotation so that it gets interpreted as relative change instead of absolute change:
$: cell("P")
.r("<1 -2 [3 -4]>".relative());
The previous code would make the cell gain 1 of “splash red” in a cycle, then lose 2 in the following one, after that gain the half of three in the first half of the last cycle and then lose the half of four in the second half of that cycle.
That’s it. Back to the spill