xxxxxxxxxx
76
var x, y, r, g, b, space, brushMinSize, brushMaxSize, colorVariability, opacity, bg;
function setup() {
bg=(255);
r = random(0, 255);
g = random(0, 255);
b = random(0, 255);
space = 33; //step
brushMinSize = 10;
brushMaxSize = 100;
colorVariability=12;
opacity = 1;
createCanvas(windowWidth, windowHeight);
background(bg);
x = width / 2;
y = height / 2;
}
function draw() {
// randomly move line
var randomValue = random();
if (randomValue < .25) {
x = x-space;
} else if (randomValue < .5) {
x = x+space;
} else if (randomValue < .75) {
y = y-space;
} else {
y = y+space;
}
// wrap around left and right sides
if (x < 0) {
x = width;
} else if (x > width) {
x = 0;
}
// wrap around top and bottom sides
if (y < 0) {
y = height;
} else if (y > height) {
y = 0;
}
// randomly change color
r += random(-1*colorVariability, colorVariability);
g += random(-1*colorVariability, colorVariability);
b += random(-1*colorVariability, colorVariability);
// don't let values go outside 0-255 range
r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 255);
var bushSizeX = random(brushMinSize,brushMaxSize);
var bushSizeY = random(brushMinSize,brushMaxSize);
//Brush head
noStroke();
fill(r, g, b, random(0,50));
rect(x,y,(random(brushMinSize,brushMaxSize), (random(brushMinSize,brushMaxSize))));
rect(x+random(brushMinSize/2),y-random(brushMinSize/2),(random(brushMinSize,brushMaxSize)/random(2,5), (random(brushMinSize,brushMaxSize)/random(2,5))));
rect(x+random(brushMinSize/2),y+random(brushMinSize/2),(random(brushMinSize,brushMaxSize)/random(2,5), (random(brushMinSize,brushMaxSize)/random(2,5))));
rect(x-random(brushMinSize/2),y-random(brushMinSize/2),(random(brushMinSize,brushMaxSize)/random(2,5), (random(brushMinSize,brushMaxSize)/random(2,5))));
rect(x-random(brushMinSize/2),y+random(brushMinSize/2),(random(brushMinSize,brushMaxSize)/random(2,5), (random(brushMinSize,brushMaxSize)/random(2,5))));
}