Project – 07

sketch
//Shaun Murray, 
//shaunmur - Section B

var nPoints = 2500
var R, G, B;
var mX, mY



function setup() {
    createCanvas(400, 400);
}

function draw() {
    mX = mouseX
    mY = mouseY

	background(mX - 75, mY - 50, mX - 150);
	push();
	translate(mX, mY);
	epi(0, 0);
	pop();

	push();
	translate(mX - 100, mY - 100);
	epi(0, 0);
	pop();

	push();
	translate(mX + 100, mY + 100);
	epi(0, 0);
	pop();

	push();
	translate(mX + 100, mY - 100);
	epi(0, 0);
	pop();

	push();
	translate(mX - 100, mY +100);
	epi(0, 0);
	pop();

	push();
	translate(mX - 200, mY);
	epi(0, 0);
	pop();

	push();
	translate(mX, mY + 200);
	epi(0, 0);
	pop();

	push();
	translate(mX + 200, mY);
	epi(0, 0);
	pop();

	push();
	translate(mX - 200, mY + 200);
	epi(0, 0);
	pop();

	push();
	translate(mX + 200, mY + 200);
	epi(0, 0);
	pop();
}

function epi(x, y) {
	var a = map(mouseX, 0, 400, 0, 50);
	var b = map(mouseY, 0, 400, 10, 90);
	R = mouseX
	G = mouseY + 50
	B = mouseY

    stroke(R, G, B);
    noFill();
    beginShape();
    for (let i = 0; i < nPoints; i++) {
        var theta = map(i, 0, 100, 0, TWO_PI);
        var x = (a + b) * cos(theta) - b*cos(((a + b) / b) * theta);
        var y = (a + b) * sin(theta) - b*sin(((a + b) / b) * theta);
        vertex(x, y);
    }
    endShape();

}


A visual representation of what you might see when you rub your eyes with your fists.

Leave a Reply