function setup() {
createCanvas(800, 600);
background( white") ;
noLoop() 5
3
function draw() {
stroke('red');
strokeWei ght (2);
holocrux(400, 300, 300);
}
/ holocrux function takes location (x,y) and size s
function holocrux(x, y, s) {
// ensure size s is more than zero
if (s> 0) {
/] a holocrux of size s is a circle at (x,y)
ellipse(x, y, 5
/ and a holocrux of size (s - 100) either side of the circle
holocrux(x + (s/2), y, s - 100);
holocrux(x - (s/2), y, 5 - 100);
+
And the result
-309-That worked. But was it worth all that effort of defining this pattern, this holocrux, in such an
obtuse way? After all, we could easily have just drawn seven circles.
Let's see why it is worth the effort. The size of the holocrux is reduced by 100 every time it is
called from holocrux(). Let's make it go down in smaller steps, say 30. So the calls to
holocrux() inside the definition of holocrux() are changed as follows.
/ and a holocrux of smaller size either side
holocrux(x + (s/2), y, $ ~ 38);
holocrux(x - (s/2), y, S$ - 30);
That should result in more circles being drawn, so let's change the stroke to be a translucent red
with stroke(255, 0, 0, 50). Here's the resull