xxxxxxxxxx
var snakes = [];
function Snake(xoff, yoff, colour) {
this.xoff = xoff;
this.yoff = yoff;
this.colour = colour;
this.move = function() {
this.xoff += 0.005;
this.yoff += 0.01;
}
this.draw = function() {
fill(this.colour);
ellipse(noise(this.xoff)*windowWidth, noise(this.yoff)*windowHeight, 20, 20);
}
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
snakes[0] = new Snake(0.0, 0.1, color(218,238,248,200));
snakes[1] = new Snake(1.0, 1.1, color(178,202,151,200));
snakes[2] = new Snake(2.0, 2.1, color(234,133,98,200));
}
function draw() {
for (i = 0; i < snakes.length; i++) {
snakes[i].move();
snakes[i].draw();
}
}