fractalkitty looking for math? fractalkitty.com

Coded Poems

masked by your reach

#random#trig#interactive#animation#accumulates#poem#symmetry#sky#space

theDistancePerceivedtheTimePerceivedyourSymmetriestheSpaceYouExistporthole

let theDistancePerceived;//is relative
let theTimePerceived = 0;//is relative
let yourSymmetries;//are beautiful
let theSpaceYouExist;
function setup() {
	theSpaceYouExist = createCanvas((theDistancePerceived = 0.9 * min(windowWidth, windowHeight)), theDistancePerceived);
	yourSymmetries = random([ 11, 13,17]);
	background(255, 250, 205);
  frameRate(50)
  describe("a mandala sand painting on a pale yellow that gets eclipsed by a yellow sun.")
}

function draw() {
	theTimePerceived += 0.05;
	translate(theDistancePerceived / 2, theDistancePerceived / 2);
	fill(255, 250, 205,10)
	stroke(255, 250, 205)
	circle(-theDistancePerceived+theDistancePerceived*2*sin(theTimePerceived/200),
				 -theDistancePerceived+theDistancePerceived*2*sin(theTimePerceived/200),theDistancePerceived)
	noStroke()
	for (let j = 0; j < yourSymmetries; j++) {
		push();
		rotate((TWO_PI / yourSymmetries) * j);
		for (let i = floor(-theDistancePerceived / 2); i < theDistancePerceived / 2; i += random(1, 5)) {
			fill(
				150 + 150 * cos((i / theDistancePerceived ) * 2 + theTimePerceived / 4),
				120 + 120 * cos((i / theDistancePerceived ) * 2 + theTimePerceived / 3),
				200 + 250 * cos((i / theDistancePerceived ) * 2 + theTimePerceived / 2),
				50
			);
			let x = i;
			let y =
				(theDistancePerceived / 5) * sin(i / 50 + theTimePerceived) * cos(i / 20 + theTimePerceived) -
				(theDistancePerceived / 20) * cos(i / 30 + theTimePerceived) -
				(theDistancePerceived / 6) * cos(theTimePerceived / 50);
			circle(x, y, 1);
		}
		pop();
	}
	porthole()
}



function porthole(){
	
	beginShape()
	
		fill(255, 250, 205)
	for(let i = 0;i<PI;i+=0.1){
		
		vertex(theDistancePerceived/2*cos(i),theDistancePerceived/2*sin(i))
	}
	vertex(-theDistancePerceived/2,0)
	vertex(-theDistancePerceived/2,theDistancePerceived/2)
	vertex(theDistancePerceived/2,theDistancePerceived/2)
	vertex(theDistancePerceived/2,0)
	
	endShape()
	beginShape()
	
	
	for(let i = PI;i<2*PI;i+=0.1){

		
		vertex(theDistancePerceived/2*cos(i),theDistancePerceived/2*sin(i))
	}
	vertex(theDistancePerceived/2,0)
	vertex(theDistancePerceived/2,-theDistancePerceived/2)
	vertex(-theDistancePerceived/2,-theDistancePerceived/2)
	vertex(-theDistancePerceived/2,0)
	
	endShape()
	
}
function keyPressed() {
	if (keyCode === 32) {
		save(theSpaceYouExist, "theSpaceYouExist", "png");
	} else {
		setup();
		draw();
	}
}