Spill: Partial colours
You can specify a cell’s colour channel-by-channel.
$: cell("P")
.red(255)
.green(0)
.blue(255)
Or with splash channels…
$: cell("P")
.r(9)
.g(0)
.b(9)
But you don’t actually need to define all three channels.
$: cell("R").r(9)
Maybe you want to only apply your rule to anything with 100% red in the red channel, no matter what’s in the green or blue channels. This rule changes anything with maximum red into blue.
$: cell("R").r(9)
$: cell("B").color("blue")
$: rule().from("R").to("B")
Likewise, you might want your rule to only change the red channel, leaving the green and blue channel unchanged. This rule changes the red channel of all blue cells.
$: cell("R").r(9)
$: cell("B").color("blue")
$: rule().from("B").to("R")
But we can go further! Cells don’t need any colour channels defined at all.
$: cell("A")
$: cell("B")
When no colour is defined, that means your rule can match any cell.
Take a look at this rule. It makes it so any cell gets swapped horizontally with any cell next to it.
$: cell("A")
$: cell("B")
$: rule()
.from("AB").to("BA")
But when a cell has no colour defined, we may as well omit the definition. There’s no need to define a cell that’s only being used symbolically like this.
$: rule()
.from("AB").to("BA")
By the way, we can make a diffusion effect by giving this rule rotational symmetry.
$: rule()
.from("AB").to("BA")
.symmetry("r")
Try changing around the symbol names to see what happens. You can get a gloopy effect by doing something like this.
$: rule()
.from("AB").to("BB")
.symmetry("r")
back to the spill