xxxxxxxxxx
120
//E.Coli variables
var bubbles = [];
var t;
function setup() {
createCanvas(500, 500);
for (var i = 0; i < 1; i++) {
bubbles[i] = new Bubble();
//time functions
//var numOfHours = hour();
//var numOfMinutes = minute();
startTime = millis();
}
t = second();
}
function draw() {
//petri dish background
stroke(200,200,5,11)
fill(232, 120, 206,20)
ellipseXpos = map(mouseX, 0,width,height,0);
ellipse(ellipseXpos, height/2,40,ellipseXpos);
ellipseXpos = map(mouseY, 0,width,height,0);
ellipse(ellipseXpos, height/2,50,ellipseXpos);
ellipse(ellipseXpos, height/20,50,ellipseXpos);
ellipse(ellipseXpos, height/100,50,ellipseXpos);
ellipse(ellipseXpos, height/2,500,ellipseXpos);
ellipse(ellipseXpos, height/2,800,ellipseXpos);
ellipse(ellipseXpos, height/200,500,ellipseXpos);
fill(101, 242, 209, 8)
ellipse(ellipseXpos, height/2,500,ellipseXpos);
fill(241, 245, 15,15)
ellipseXpos = map(mouseX, 12,width,height,0);
rect(ellipseXpos, 1,10,mouseX);
fill(101, 242, 209, 8)
rect(0, 0, width, height)
ellipse(200, 200, 350, 350)
stroke(79, 193, 167, 7)
line(0, 10, 390, 390)
line(0, 10, 10, 400)
fill(101, 242, 209)
ellipse(200, 200, 200, 200)
fill(244, 178, 229,10)
//Pet Amoeba
fill(250, 10, 242)
stroke(250, 250, 245)
ellipse(mouseX, mouseY, mouseX, mouseY)
fill(250, 10, 242, 60)
ellipse(mouseX, mouseY, 20, 200, 300)
ellipse(mouseX, mouseY,-mouseY, 200)
ellipse(mouseX, mouseY-50,-mouseY, 200)
fill(255, 242, 0, 230)
ellipse(mouseX, mouseY-50, 20, 20)
ellipse(mouseX, mouseY+50, 20, 20)
//E.coli-Bubble construction
for (var i = 0; i < bubbles.length; i++) {
bubbles[i].move();
bubbles[i].display();
}
//Exponential Growth code
print(millis());
var len = bubbles.length;
if (t != second()) {
for (i = 0; i < len; i++) {
bubbles.push(new Bubble());
}
t = second();
}
//10 second reset cycle
if (bubbles.length > 1023) bubbles = [new Bubble()];
}
//Movement/generation
function Bubble() {
this.x = random(0, width);
this.y = random(0, height);
this.display = function() {
stroke(255);
fill(255, 12, 202, 20);
rect(this.x, this.y, 35, 20, 50);
fill(255, 12, 24, 25)
ellipse(this.x + 10, this.y + 10, 9, 7)
}
this.move = function() {
this.x = this.x + random(-1, 1);
this.y = this.y + random(-1, 1);
}
//Thanks to Huw Messie who helped me debug + with cycling & Everest Pipkin for the list variablw
}
//Interaction?
function mousePressed(){
var choice = [OVERLAY,MULTIPLY,SCREEN,DODGE,BURN,DIFFERENCE,EXCLUSION, DARKEST, LIGHTEST, HARD_LIGHT - SCREEN, SOFT_LIGHT ]
blendMode(random(choice))
}