Algorithmic Brush
I made a picture of a girl wearing a big hat on a misty day.
I made it using the mr doob harmony app, on the sketchy tool. The sketchy tool is an algorithmic brush, which is code which elaborates on lines you draw. I looked at the source code. Here it is:
stroke: function( mouseX, mouseY )
{
var i, dx, dy, d;
this.points.push( [ mouseX, mouseY ] );
this.context.lineWidth = BRUSH_SIZE;
this.context.strokeStyle = "rgba(" + COLOR[0] + ", " + COLOR[1] + ", " + COLOR[2] + ", " + 0.05 * BRUSH_PRESSURE + ")";
this.context.beginPath();
this.context.moveTo(this.prevMouseX, this.prevMouseY);
this.context.lineTo(mouseX, mouseY);
this.context.stroke();
for (i = 0; i < this.points.length; i++)
{
dx = this.points[i][0] - this.points[this.count][0];
dy = this.points[i][1] - this.points[this.count][1];
d = dx * dx + dy * dy;
if (d < 4000 && Math.random() > (d / 2000))
{
this.context.beginPath();
this.context.moveTo( this.points[this.count][0] + (dx * 0.3), this.points[this.count][1] + (dy * 0.3));
this.context.lineTo( this.points[i][0] - (dx * 0.3), this.points[i][1] - (dy * 0.3));
this.context.stroke();
}
}
this.prevMouseX = mouseX;
this.prevMouseY = mouseY;
this.count ++;
},
I can see that there are loops like I use in Scratch, and a random bit, too.