Project – 06 – Clock

sketch
var angle = 0

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

function draw() {
	background(130, 125, 187)
	var min = minute()
	var sec = second()
	var hours = hour()
	
	//gradient cirles
	push()
	translate(200, 200)
	fill(84, 62, 116)
	stroke(30, 24, 45)
	strokeWeight(0.2)
	scale(10)
	circle(0, 0, 10)
	pop()

	push()
	translate(200, 200)
	fill(120, 85, 167)
	strokeWeight(0)
	scale(10)
	circle(0, 0, 9)
	pop()

	push()
	translate(200, 200)
	fill(140, 105, 187)
	strokeWeight(0)
	scale(10)
	circle(0, 0, 8)
	pop()

	push()
	translate(200, 200)
	fill(160, 125, 207)
	strokeWeight(0)
	scale(10)
	circle(0, 0, 7)
	pop()

	//circle counting seconds
	noFill()
	push()
	translate(200, 200)
	stroke(53, 44, 43)
	strokeWeight(0.4)
	scale(sec/10)
	circle(0, 0, 10)
	pop()

	//circle counting minutes
	push()
	translate(200, 200)
	stroke(53, 44, 43)
	strokeWeight(0.2)
	scale((12 + min/20))
	circle(0, 0, 10)
	pop()

	//circle counting hours
	push()
	translate(200, 200)
	stroke(53, 44, 43)
	strokeWeight(0.2)
	scale((32 + hours/10))
	circle(0, 0, 10)
	pop()

	//large outside circle
	push()
	translate(200, 200)
	stroke(53, 44, 43)
	strokeWeight(0.3)
	scale(20)
	circle(0, 0, 10)
	pop()

	//line around outside circle
	push()
	translate(200, 200)
	stroke(49, 41, 42)
	strokeWeight(2)
	scale(25)
	circle(0, 0, 10)
	pop()

	//rotating arc
	push()
	translate(200, 200)
	stroke(100, 80, 130)
	strokeWeight(3)
	rotate(radians(angle))
	arc(0, 0, 200, 200, 0, PI, OPEN)
	pop()
	angle+=1
}

For this project, I wanted to use circles to represent time. The black circle outline in the very middle represents seconds. The circle outline outside of the purple circle represents minutes. And the final circle outline represents the hour.

LO-06: Randomness

The project I chose to focus on this week is Tim Knowles’ Civita 24 hour Balloon Drawing. I admire this artwork because of its uniqueness. Knowles’ method of incorporating randomness made his final piece very unconventional but also very simple. To make his drawing, Knowles attached a pen to a helium balloon whose motions were “randomly” generated by the wind movements during the day which drew on a 24 meter long slowly moving paper throughout the day. Although wind movements are not completely random, there was a lot of variability in his final 24-meter long drawing which highlighted the balloon’s “random” movements. Knowles’ artistic sensibilities are manifested in the final piece since, like many of his other artworks, he incorporates nature as an art tool to produce very simple but unique pieces.

Civita 24 Hour Balloon Drawing (Tim Knowles, 2001)

Project-06-Abstract Clock

For my abstract clock, I decided to use the concept of a flower garden. The flowers appear once per minute and change color every hour. I also wanted to incorporate day and night in my clock so I made the sky and grass get lighter and darker depending on the hour of the day (ex: from midnight to noon, they get lighter). To incorporate seconds, I added a butterfly that takes 1 minute to move completely across the canvas (flying forward every second).

sketch
var flowerX = []; // flower x positions
var flowerY = []; // flower y positions
var flowerColor = []; // 24 colors (different color per hour)
var grass = []; // stores shade of grass (changes once per hour)
var sky = []; // stores shade of sky (changes once per hour like grass)

// flower r, g, b
var flowerR = 80; 255, 136, 136
var flowerG = 0;
var flowerB = 215;

// grass r, g, b
var grassR = 10; 
var grassG =  90;
var grassB = 30;

// sky r, g, b
var skyR = 25; 
var skyG = 50; 
var skyB = 90;

// butterfly positions
var butterflyX = 0;
var butterflyY = 60;

function setup() {
    createCanvas(480, 400);
    for(var i = 0; i < 24; i ++) { // initialize arrays of elements that change every hour
    	flowerColor[i] = color(flowerR, flowerG, flowerB);
    	grass[i] = color(grassR, grassG, grassB);
    	sky[i] = color(skyR, skyG, skyB);

    	if(i > 12) { // gets darker past noon (day to night)
    		grassR -= 3;
	    	grassG -= 11;
	    	grassB -= 5;
	    	
	    	flowerG += 9;
	    	flowerR -= 10;

	    	skyR -= 10;
	    	skyG -= 12;
	    	skyB -= 14;
    	}
    	else { // gets brighter from midnight (night to day)
    		grassR += 3;
	    	grassG += 11;
	    	grassB += 5;
	    	
	    	flowerB += 10;

	    	skyR += 10;
	    	skyG += 12;
	    	skyB += 14;
    	}
    }
    for(var i = 0; i < 60; i ++) { // once per minute
    	if(i%10 == 0) { // first column of flowers
    		flowerX[i] = 60;
    	}
    	else { // all other columns
    		flowerX[i] = flowerX[i - 1] + width/12;
    	}
    	if(i <= 9) { // first row of flowers
    		flowerY[i] = 2*height/5;
    	}
    	else { // all other rows
    		flowerY[i] = flowerY[i - 10] + width/12;
    	}
    }
}

function drawFlower() {
	// petals
	noStroke();
	var theta = 0;
	var x = 10*cos(radians(theta));
	var y = 10*sin(radians(theta));
	for(var i = 0; i < 8; i ++) {
		rotate(radians(theta));
		ellipse(x, y, 10, 10);
		theta += 45;
	}
	// center
	fill("yellow");
	circle(0, 0, 13);
}

function drawButterfly() {
	fill(255, 192, 204);
	ellipse(0, 0, 20, 20);
	ellipse(0, 20, 20, 20);
	noStroke();
	fill(255, 170, 180);
	ellipse(15, 0, 30, 35);
	ellipse(15, 20, 30, 35);
	stroke(87, 39, 26);
	strokeWeight(4);
	line(-6, 10, 26, 10);
	strokeWeight(2);
	line(26, 10, 36, 5);
	line(26, 10, 36, 15);
}

function draw() {
	noStroke();

	// background changes by hour
	background(sky[hour()]);
	//background(sky[12]);

	// grass changes by hour
	fill(grass[hour()]);
	//fill(grass[12]);
	rect(0, height/3, width, 2*height/3);

	// draw flower once per minute 
	for(var i = 0; i < minute(); i ++) {
		push();
		translate(flowerX[i], flowerY[i]);
		fill(flowerColor[hour()]);
		//fill(flowerColor[12]);
		drawFlower();
		pop();
	}

	// butterfly moves across screen once per minute
	push();
	translate(map(second(), 0, 60, -15, width + 10), butterflyY);
	drawButterfly();
	pop();
}


















sketch on goodnotes

Looking Outwards 05

Looking Outwards 05: 3D Computer Graphics

https://threejs.org/examples/#webgl_animation_keyframes

For this project, I want to discuss a Javascript library called three.js and projects that use this library to create short animatics, motion experiments and virtual worlds. Three.js is a cross-browser JavaScript library and application programming interface used to create and display animated 3D computer graphics in a web browser using WebGL. This project by Glenn Fox, is a model of a unit of buildings, shops and culture in Tokyo. Fox’s body of work that shows caricature of the build environment. 3D computer graphics have particular file types like .obj that can be created with code. Algorithms are used to create generic shapes that make up the building blocks of the rendered image. A lot of Fox’s work is used in Game Design environments.

Project 5: Wallpaper

My process for creating this wallpaper assignment was to first create the repeating sun pattern and then the repeating snake pattern. To accomplish this, I created a separate sun function and snake function. After I created the two functions, I used a series of for loops to create the patterns. The symbols of the snake and the sun were inspired by the Temple of the Feathered Serpent in Teotihuacán.

sketchDownload
function setup() {
    createCanvas(500, 500);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
	background(97,104,181);
	//sun pattern
	push();
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,50);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,100);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,150);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,200);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,250);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,300);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,350);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,400);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	push();
	translate(0,450);
	for(sunRow = 0; sunRow <= 9; sunRow += 1){
		sun();
		translate(50,0);
		}
	pop();
	translate(-20,0);
	for(drawSnake = 0; drawSnake <= 5; drawSnake += 1){
		snake();
		translate(0,105);
	}
	noLoop();
}

function sun() {
	noStroke();
	fill(97,104,181);
	square(0,0,50);
	fill(249,235,219);
	//sun 1
	circle(25,25,25);
	//sun rays 1
	stroke(249,235,219);
	line(25,25,25,5);
	line(25,25,25,45);
	line(5,25,25,25);
	line(45,25,25,25);
	line(25,25,10,10);
	line(25,25,40,40);
	line(25,25,10,40);
	line(25,25,40,10); 
}

function snake(){
	noStroke();
	fill(10,random(100,255),0);
	//body
	beginShape();
		vertex(125,25);
		curveVertex(150,35);
		curveVertex(200,25);
		curveVertex(250,35);
		curveVertex(300,25);
		curveVertex(320,30);
		curveVertex(350,40);
		curveVertex(375,30);
		curveVertex(400,25);
		vertex(475,32.5);
		curveVertex(400,34);
		curveVertex(350,50);
		curveVertex(300,35);
		curveVertex(250,50);
		curveVertex(200,35);
		curveVertex(150,50);
		curveVertex(125,30);
	endShape(CLOSE);
	push();
	//tongue
	stroke(255,10,0);
	line(90,29,80,29);
	//head
	noStroke();
	ellipse(110,29,40,15);
	//eye
	fill(255);
	ellipse(110,27,5,3);
	strokeWeight(3);
	stroke(0);
	//pupil
	point(110,27);
	
	
}

Project 02 – Variable Face

sketch
var canvaswidth = 640
var eyehx = 230
var eyehy = 270
var lidh = 255
var face = 0
var r=255
var g=255
var b=255

function setup() {
    createCanvas(canvaswidth, 510);
    background(220);
}

function draw() {

	background(r,g,b);

	//face
	strokeWeight(6)
	stroke(25)
	fill(229,149,95);
	ellipse(150,110,200,200); //left ear 
	ellipse(canvaswidth-150,110,200,200); //right ear
	fill(46,44,44);
	ellipse(150,110,120,120); //left ear inner
	ellipse(canvaswidth-150,110,120,120); //right ear inner
	fill(229,149,95); 
	ellipse(canvaswidth/2,270,500,450); //face
	noStroke();
	fill(242,219,140); 
	ellipse(canvaswidth/2,380,320,230); //mouth/chin

	//eyes
	fill(37,37,41)
	ellipse(220,280,60,60); // left eye
	ellipse(canvaswidth-220,280,60,60); // right eye
	fill(255,255,240);
	ellipse(eyehx,eyehy,20,20); // left eye highlight
	ellipse(canvaswidth-eyehx+20,eyehy,20,20); // right eye highlight

	//eyelids
	stroke(229,149,95); 
	strokeWeight(20);
	line(180,255,256,lidh); // left 
	line(canvaswidth-180,255,canvaswidth-256,lidh); // right



	//moon
	noStroke()
	fill(242,229,196);
	ellipse(canvaswidth/2,180,230,200);
	fill(229,149,95);
	ellipse(canvaswidth/2+40,180,175,143);


    //mouth
	if (face == 0){
		stroke(25);
		line(270,400,canvaswidth-270,400); //flat line
	} else if (face == 1){
		stroke(25);
		strokeWeight(6)
		fill(240,184,163)
		ellipse(canvaswidth/2,400,120,70);
		noStroke();
		fill(230,154,143);
		ellipse(320, 414,96,50);
		noFill();
		stroke(25);
		ellipse(canvaswidth/2,400,120,70); //mouth open


	} else if (face == 2){
		stroke(25);
		strokeWeight(22);
		line(270,440,canvaswidth/2,400);
		line(canvaswidth-270,440,canvaswidth/2,400); //upset
	}
}


function mousePressed() {
	lidh = random(218,264);
	r = random(0,255);
	g = random(0, 255);
	b = random(0, 255);
	if (face == 2){
		face = 0;
	} else {
		face += 1;
	}
	


}

LO 05 – Cindermedusae

A few generated creatures

Cindermedusae is a computer algorithm that generates jellyfish-like creatures based on a set of parameters. The project was developed by Marcin Ignac, a polish artist / programmer / designer living in London. The project was inspired by Ernst Haeckel’s book “Kunstformen der Natur,” after Ignac became fascinated with deep sea life, specifically jellyfish.

I like this project because of how the 3D images take on the style of old anatomical nature drawings. While the forms are completely computer generated, the rendering gives the final images the feeling of an analog book. I also like the way that the set of changeable parameters mimics the inherent variation of nature, allowing the user to create an endless number of perfectly unique creatures.

Project 05 – Wallpaper

sketch
// WALLPAPER
// TERESA LOURIE
// PROJECT 05 A
// SECTION D


var s = 120;
//var column = 3;

function setup() {
    createCanvas(500, 500);
    background(150, 175, 255);
    
}

function draw() {
	//var d = s*sqrt(3)/2;  //column offset
	for (var x = 0; x <= 600; x += s) {
		push();
		translate(-120, 0);
		
		
		for (var y = -50; y<=600; y += s){ 
			push();
			translate(x, y);
			
			push();  //background pattern
			translate(30, 30);
			stroke(175, 200, 255);
			strokeWeight(20);
			line(180, 0, 180, 180); //vertical
			line(0, 0, 180, 0); //horizontal
			push();
			translate(-60, 60);
			line(180, 0, 180, 180);
			line(180, 0, 0, 0);
			pop();
			pop();


			strokeWeight(20);
			stroke(225,185,110); //mushroom A stem
			line(0, 0, 0, random(15, 25));
			

			fill(190,125,50) //mushroom A cap
			noStroke();
			arc(0, 0, random(45, 70), random(40, 60), PI, 0, CHORD);
			pop();
			

			push();
			translate(x+60, y+60);

			strokeWeight(random(15,25));
			stroke(255); //mushroom B stem
			line(0, 0, 0, random(15, 25));
			
			fill(190, 0, 0);
			noStroke();
			arc(0, 0, random(45, 70), random(40, 60), PI, 0, CHORD); //mushroom B cap

			pop();
			



		}
		pop();

	}
	noLoop();
	
	

}

Space Wallpaper

For this project I knew I wanted to do something involving layered circles, and I actually accidentally came across a “moon” in another idea I was developing. I switched to space theme and proceeded from there. Using closely aligned circles I created “stars” from negative space and then used the positive space to fill with different space objects.

Outer Space

function setup() {
    createCanvas(800, 560);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
	scale(2);	//zoom in x2
	noStroke();
background(255);


fill(58,37,165);	//dark blue
rectMode(CORNER);		//x an y are corner coordinates
	rect(0,0,width,23);	//blocking out the "stars" at the top and bottom
	rect(0,260,width,23)
 
translate (50,0);		//move 50 right and 0 down
	for (var y = -100; y <= 600; y += 40) {		//start at -100, add 40 to y until y=600
		for (var x = -100; x <= 800; x += 50) {		//start at -100, add 50 to x until x=800
			circle(x, y, 58);
		}
	}
pop();

push();
translate(0,-20)		//move 20 up
	fill(255,239,0);		//yellow
	for (var y3 =0; y3 <= 300; y3 += 80) {		//every other circle
		for (var x3 = 0; x3 <= 800; x3 += 100) {	//every other circle
			circle(x3, y3, 30);		//moon
		}
	}
pop();

push();
translate(-6,-28);		//move 6 left, 28 up
	for (var y4 =0; y4 <= 300; y4 += 80) {		//every other
		for (var x4 = 0; x4 <= 800; x4 += 100) {	//every other
			circle(x4, y4, 30);		//moon "shadow"
		}
	}
pop();

push();
translate(50,100);		//50 right, 100 down
	for (var y5 =0; y5 <= 100; y5 += 80) {	//every other
		for (var x5 = 0; x5 <= 300; x5 += 200) {
			planet(x5,y5);		//run planet function
		}
	}
pop();

push();
translate(100,60);		//100 right, 60 down
	for (var y6 =0; y6 <= 100; y6 += 80) {		//every other, constricted to the middle of the canvas
		for (var x6 = 0; x6 <= 300; x6 += 400) {	//constricted to run only once
			rocket(x6,y6);		//run rocket function
		}
	}
			
pop();

push();
	for (var y7 =0; y7 <= 200; y7 += 80) {		//every one
		for (var x7 = 0; x7 <= 300; x7 += 200) {	//every 4
			hat(x7,y7);		//run hat function
		}
	}	
pop();

push();
translate(0,50)		//move down 50
	for (var y8 =0; y8 <= 150; y8 += 80) {	//every other
		for (var x8 = 0; x8 <= 150; x8 += 100) {	//every other, constrained to left side
			UFO(x8,y8);		//call UFO function
		}
	}	
pop();

push();
translate(0,50)		//move down 50
	for (var y9 =0; y9 <= 150; y9 += 80) {	//every other
		for (var x9 = 0; x9 <= 150; x9 += 100) {	//every other, constrined to right side
			alien(x9,y9);		//call alien function
		}
	}	
}

function hat (x7,y7){

push();

	translate(x7,y7)	//repeat translation
fill(64,234,240);	//light blue
	rotate(radians(-7));	//rotate right
		triangle(0,59,2.5,45,8.5,58);	//hat
fill(255);	//white
	circle(2.5,45,3);	//pom
	quad(0,59,0,61,8.5,60,8.5,58)	//hat base

pop();
}

function planet(x5,y5){
push();

translate(x5,y5)
	rotate (radians(-10));	//rotate right
		fill(250,139,99,150);	//opaque red-orange
			ellipse(0,0,40,10);		//ring
fill(240,128,43);		//orange	
	rotate(radians(10));		//negate rotation
		circle(0,0,25);		//planet

pop();	

}

function rocket(x6,y6){

push();

translate(x6,y6);
	fill(255);	//white
		rotate(radians(-50));	//rotate right
			rect(0,50,10,20);	//rocket body
fill(255,0,0);	//red
	triangle(0,50,10,50,5,45);	//rocket top
	quad(0,70,-3,75,13,75,10,70);	//rocket bottom
fill(255,171,0);	//bright orange
	quad(-2,75,1,80,9,80,12,75);	//outer fire
	triangle(-1,75,5,85,11,75);		//outer fire bottom
fill(255,255,138);	//bright yellow
	triangle(1.5,75,5,82,8.5,75);	//inner fire
fill(139,139,139);	//gray
	circle(5,56,7);		//window frame
fill(2,217,225);	//light blue
	circle(5,56,5);		//window pane

pop();
}

function UFO(x8,y8){

push();

translate(x8,y8)
	fill(152,152,152);	//gray
		ellipse(0,50,40,15);	//ufo body
		quad (-5,52,-15,60,-14,61,-4,53)	//left landing leg
		rect (-2,52,1.5,10)		//middle landing leg
		quad (1,52,11,61,12,60,4,53)	//right landing leg
fill(175,238,170,200);	//opaque green-blue
	ellipse(0,45,25,15);	//window dome
fill(255,0,0);		//red
	circle(-12,52,3);	//left light
	circle(12,52,3);	//right light
fill(255,255,0);	//yellow
	circle(0,54.5,3);	//middle light

pop();
}

function alien(x9,y9){

	push();

translate(x9,y9)
	fill(198,0,191);	//purple-red
		ellipse(200,50,10,20)		//body
		quad(198,44,201,45,191,54,190,53);	//left arm
		quad(202,44,201,47,209,54,210,53);	//right arm
		quad(198,54,201,55,191,64,190,63);	//left leg
		quad(202,54,201,57,209,64,210,63);	//right leg
fill(1,233,1);	//bright green
	ellipse(200,40,15,10);	//head
	circle(190.5,53.5,2);	//left hand
	circle(209.5,53,2);		//right hand
	circle(190.5,63.5,2);	//left foot
	circle(209.5,63.5,2);	//right foot
fill(0);	//black
	ellipse(196,40,3);	//left eye
	ellipse(200,38,3);	//middle eye
	ellipse(204,40,3);	//right eye
	arc(200,42,3,3,0,PI); 	//smile
fill(134,227,246,150);	//opaque light blue
	ellipse(200,40,20,13);	//helmet
fill(199,199,199);	//ligth gray
	rect(195,44,10,2);	//helmet strap

pop();
}

Project 5: Wallpaper

sketchDownload
var leafSize = 40;

function setup() {
    createCanvas(400, 400);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    background(111, 59, 72)
    for (var x = 20; x <= 400; x += 50) {
        for (var y = 20; y <= 400; y += 100) {
            push();
            leaf(x, y);
            pop();
            
        }    
    }
    for (var x = 40; x <= 400; x += 50) {
        for (var y = 80; y <= 400; y += 100) {
            push();
            secondLeaf(x, y);
            pop();
            
        }    
    }

    noLoop();
}
function leaf(x, y) {
    //decoration
    noStroke();
    fill(167, 80, 55)
    circle(x-5, y+7, leafSize-15);
    noFill();
    stroke(167, 80, 55);
    arc(x, y, 50, 50, PI/4, 5*PI/4);
    
    stroke(225);
    //left half
    arc(x, y, leafSize, leafSize, 2*PI/3, 4*PI/3, OPEN);
    //right half
    translate(-20, 0);
    arc(x, y, leafSize, leafSize, 5*PI/3, PI/3, OPEN);
    //stem
    translate(10, 0);
    triangle(x-2, y+30, x, y-5, x+2, y+30);
    line(x-5, y-5, x, y);
    line(x, y, x+5, y-5);
    line(x-5, y+5, x, y+10);
    line(x, y+10, x+5, y+5);
}

function secondLeaf(x, y) {
    //decoration
    noStroke();
    fill(207, 106, 39)
    circle(x, y-8, leafSize/2);
    noFill();
    stroke(207, 106, 39);
    arc(x, y, 50, 50, 5*PI/4, PI/4);

    stroke(225);
    //left half
    arc(x, y, leafSize/2, leafSize/2, 2*PI/3, 11*PI/6, OPEN);
    arc(x-13, y-13, leafSize/2, leafSize/2, PI/6, 2*PI/3, OPEN);
    //right half
    arc(x-10, y, leafSize/2, leafSize/2, 7*PI/6, PI/3, OPEN);
    arc(x+3, y-13, leafSize/2, leafSize/2, PI/3, 5*PI/6, OPEN);
    //stem
    translate(-5, 0);
    line(x, y, x, y-20);

}

I got the inspiration for my wallpaper from the fall season and leaves floating in the air.