anabelle’s project 05

here’s my project : D

sketch
// anabelle lee .-.
// section c
// kaylalee
// project 5

let firstSpiralX = [];
let firstSpiralY = [];

let secondSpiralX = [];
let secondSpiralY = [];

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

function draw() {
    background(185, 70, 44);

    leftHalf();
    rightHalf();

    push();
    translate(450, 0);
    leftHalf();
    rightHalf();
    pop();

    push();
    translate(450, 0);
    leftHalf();
    rightHalf();
    pop();

    // for bouquets
    setBouquet();
    setOtherBouquet();

    noLoop();

}

/* my functions */
function setBouquet(x, y) {
    for (var centerX = 145; centerX < (width + 50); centerX += 460) {
        for (var centerY = 175; centerY < height; centerY += 350) {
            push(); 
            bigGlaze(centerX, centerY);
            pop();
        }
    }
}

function setOtherBouquet() {
for (var centerX = 380; centerX < width + 50; centerX += 460) {
        for (var centerY = 20; centerY < height; centerY += 350) {
            push(); 
            bigGlaze(centerX, centerY);
            pop();
        }
    }
}

function leftHalf() {
    for (var theta = 0; theta < height + 50; theta += 10) {
        glazeBud(-20 + 80*cos(radians(theta)), theta) ;
    }

    for (var theta = 0; theta < height + 50; theta += 30) {
        push(); 
        glazeLily(60 + 60*cos(radians(theta)), theta);
        pop();
    }

    for (var theta = 0; theta < height + 50; theta += 80) {
        push(); 
        glazeLinesLoop(30 + 60*cos(radians(theta)), theta);
        pop();
    }
}

function rightHalf() {
    for (var theta = 0; theta < height; theta += 10) {
        glazeBud(330 + -80*cos(radians(theta)), theta) ;
    }

    for (var theta = 0; theta < height; theta += 30) {
        push(); 
        glazeLily(250 + -60*cos(radians(theta)), theta);
        pop();
    }

    for (var theta = 0; theta < height; theta += 80) {
        push(); 
        glazeLinesLoop(280 + -60*cos(radians(theta)), theta);
        pop();
    }
}

function glazeLily(x, y) {

    // large petals
    push();
    translate(x, y);
    for(var i = 0; i <= 5; i += 1) {
        push();
        rotate(radians(36 + i*-72));
        largePetal(7, 25);
        pop();
    }

    // small petals
    for(var i = 0; i <= 5; i += 1) {
        push();
        rotate(radians(i*-72));
        smallPetal(5, 12.5);
        pop();
    } 
    fill(239, 233, 193);
    noStroke();
    circle(0, 0, 12.5)

    pop();
}

function smallPetal(w, h) {

    fill(232, 234, 238);
    stroke(232, 234, 238);

    beginShape(); // left half of smaller petal
    vertex(0, -h);
    bezierVertex(0 - w/10, -9*h/10, -2*w, -h/2, -2*w/3, 0);
    endShape();

    beginShape(); // right half of smaller petal
    vertex(0, -h);
    bezierVertex(0 + w/10, -9*h/10, 2*w, -h/2, 2*w/3, 0);
    endShape();

    triangle(-0.65*w, 0, 0, -h, 0.65*w, 0); // fill the smaller petal
}

function largePetal(w, h) {

    fill(114, 181, 223);
    stroke(148, 162, 228);

    beginShape(); //left half
    vertex(0, -h);
    bezierVertex(0 - w/9, -9*h/10, -1.5*w, -h/2, -w/3, 0);
    endShape();

    beginShape(); // right half
    vertex(0, -h);
    bezierVertex(0 + w/9, -9*h/10, 1.5*w, -h/2, w/3, 0);
    endShape();

    triangle(-w/3, 0, 0, -h, w/3, 0); // fill the smaller petal
}

function glazeBud(x, y) { 
    push();
    translate(x, y);
    for(var i = 0; i < 5; i += 1) {
        push();
        rotate(radians(i*72));
        glazeFragment(7, 7);
        pop();
    } pop();
}

function glazeFragment(w, h) { // only draws 1/5th of glazeBud

    // big circle
    fill(148, 162, 228);
    stroke(148, 162, 228);
    point(0, 0);
    arc(0, 0, 2*w, -2*h, radians(225), radians(315));

    // point arcs
    // left
    stroke(201, 208, 231);
    noFill();
    beginShape();
    vertex(0, -2*h/3);
    bezierVertex(-w/50, -4*h/8, -w/10, -3*h/8, -w/4, -h/3);
    endShape();

    // right
    beginShape();
    vertex(0, -2*h/3);
    bezierVertex(w/50, -4*h/8, w/10, -3*h/8, w/4, -h/3);
    endShape();

    fill(201, 208, 231);
    arc(0, 0, 4*w/5, 4*w/5, radians(225), radians(315));
    triangle(w/9, -h/4, 0, -2*h/3, -w/9, -h/4);

    // stamen
    stroke(130, 150, 255);
    fill(148, 162, 228);
    circle(-2*w/5,-h/2, w/8);
    circle(2*w/5, -h/2, w/8);
    line(-2*w/5, -h/2, 0, 0);
    line(2*w/5, -h/2, 0, 0);
}

function glazeLinesLoop(x, y) {
    push();
    translate(x, y);
    for (var i = 0; i <= 5; i += 1) {
        push();
        rotate(radians(i*72));
        glazeLines(10, 25);
        pop();
    } pop();
}

function glazeLines(w, h) {
    noFill();
    stroke(248, 237, 122);

    beginShape(); // left half of smaller petal
    vertex(0, -h);
    bezierVertex(0 - w/10, -9*h/10, -2*w, -h/2, -2*w/3, 0);
    endShape();

    beginShape(); // right half of smaller petal
    vertex(0, -h);
    bezierVertex(0 + w/10, -9*h/10, 2*w, -h/2, 2*w/3, 0);
    endShape();
}

function bigGlaze(x, y) {

    // large petals
    push();
    translate(x, y);
    for(var i = 0; i <= 5; i += 1) {
        push();
        rotate(radians(36 + i*-72));
        bigLargePetal(30, 50);
        pop();
    }

    // small petals
    for(var i = 0; i <= 5; i += 1) {
        push();
        rotate(radians(i*-72));
        bigSmallPetal(15, 40);
        pop();
    } 

    fill(239, 233, 193);
    noStroke();
    circle(0, 0, 25)

    pop();
}

function bigSmallPetal(w, h) {

    fill(117, 162, 191);
    stroke(200, 190, 255);

    beginShape(); // left half of smaller petal
    vertex(-30, -h);
    bezierVertex(-30 - w/10, -9*h/10, -2*w, -h/2, -2*w/3, 0);
    endShape();

    beginShape(); // right half of smaller petal
    vertex(-30, -h);
    bezierVertex(-30 + w/10, -9*h/10, 2*w, -h/2, 2*w/3, 0);
    endShape();

    triangle(-0.65*w, 0, 0, -h, 0.65*w, 0); // fill the smaller petal
}

function bigLargePetal(w, h) {

    fill(47, 95, 138);
    stroke(0, 51, 102);

    beginShape(); //left half
    vertex(-20, -h);
    bezierVertex(-20 - w/9, -9*h/10, -1.5*w, -h/2, -w/3, 0);
    endShape();

    beginShape(); // right half
    vertex(-20, -h);
    bezierVertex(0 + w/9, -9*h/10, 1.5*w, -h/2, w/3, 0);
    endShape();

    triangle(-w/3, 0, 0, -h, w/3, 0); // fill the smaller petal
}

Project 5- Wallpaper

Graham Murtha

Section A

For the wallpaper, I tried to recreate a typical celtic cross pattern, which is made of overlapping and interlocking loops and cusps.

sketch
// Graham Murtha
//Section A
//gmurtha@andrew.cmu.edu
//Project 05- CELTIC CROSS!!


var cell = 80; // cell size 

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

function draw() {
    background(0, 60, 20);
    for (var y = -60; y < height +60; y += 80){
        for (var x = -60; x < width +60; x += 80){
        knot(x, y);
        }
    }
    noLoop();
}


function knot(x, y){
    push();
    translate(x, y);

    noFill()
    // base circle outline
    stroke(0);
    strokeWeight(6);
    ellipse(0,0,cell-5);

    //base circle color fill
    stroke(120,130,0);
    strokeWeight(4);
    ellipse(0,0,cell-3)


    //center circle outline
    stroke(0);
    strokeWeight(6);
    ellipse(0,0,cell/3)
     //center circle color
    stroke(120,130,0);
    strokeWeight(2);
    ellipse(0,0,cell/3)

    // TINY center circle outline 
    stroke(0);
    strokeWeight(4);
    ellipse(0,0,cell/6)
    // TINY center circle color 
    stroke(120,130,0);
    strokeWeight(1);
    ellipse(0,0,cell/6)

stroke(0)
    strokeWeight(4)

    
    //crossing leaf shape OUTLINES (rotated in all 4 quadrants)
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();


    stroke(120,130,0)
    strokeWeight(2)

    
    //crossing leaf shape FILLS (rotated in all 4 quadrants)
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();

    rotate(radians(90))
    beginShape();
    curveVertex(0,0);
    curveVertex(cell/4,cell/8);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/2,cell/2);
    curveVertex(cell/8,cell/4);
    curveVertex(0,0);
    endShape();



    strokeWeight(5)
    stroke(0);
  // central lobe OUTLINE - wide ellipses
    rotate(radians(45));
    arc(0,0,cell*sqrt(2)/2,cell/2,radians(0),radians(180));
    arc(0,0,cell*sqrt(2)/2,cell/2, radians(180),radians(0));

    rotate(radians(90));
    arc(0,0,cell*sqrt(2)/2,cell/2,radians(0),radians(180));
    arc(0,0,cell*sqrt(2)/2,cell/2, radians(180),radians(0));

    strokeWeight(3)
    stroke(120,130,0);

    // central lobe FILL- wide ellipses
    rotate(radians(90));
    arc(0,0,cell*sqrt(2)/2,cell/2,radians(0),radians(180));
    arc(0,0,cell*sqrt(2)/2,cell/2, radians(180),radians(0));

    rotate(radians(90));
    arc(0,0,cell*sqrt(2)/2,cell/2,radians(0),radians(180));
    arc(0,0,cell*sqrt(2)/2,cell/2, radians(180),radians(0));
   
    pop();
    noLoop();
}


   

Project 5 – Wallpaper

For my wallpaper, I wanted to try to replicate the “jazz” pattern seen on your typical office styrofoam cup.

csavitzv_05
//Cole Savitz-Vogel
//csavitzv
//Section A

function setup() {
    createCanvas(600, 600);
    background(0);
    noLoop();
}

function draw() {
    fill(230);
    background(230);
    for (var y = -60; y <= height+50; y+= 70) {
      stripes(0, y);
     }
    for (var x = -100; x <= width+50; x += 150) {
        for (var y = -10; y <= height+50; y += 70)
     pastel(x, y);
     }
    for (var x = -80; x <= width+50; x += 100) {
        for (var y = -50; y <= height+50; y += 70)
     curvy(x, y);
     }
    for (var x = -50; x <= width+50; x += 2) {
        for (var y = -50; y <= height+50; y += 10)
     styro(x, y);
     }
}

//Stripes - The backmost blue line
function stripes(x,y) {
    push();
    translate(x,y);
    strokeWeight(30);
    curveTightness(3);
    stroke(94, 205, 255, 90);
    curve(-3000, 60, 200, 36, 400, 20, 3000, 50);
    pop();
}

//Curvy - The purple frontmost curves; The color varies slightly
function curvy(x, y) {
    push();
    noFill();
    translate(x,y);
    strokeWeight(5);
    curveTightness(-5)
    rotate(1);
    stroke(random(100, 130), 10, (100, 150));
    curve(-10, 16, 50, 46, 90, 34, 130, 60);
    translate(10, 20);
    rotate(3);
    curve(-10, 6, 50, 36, 90, 24, 130, 50);
    pop();
}

//Pastel - The middleground blue lines; The color varies slightly
function pastel(x,y) {
    push();
    translate(x,y);
    strokeWeight(15);
    stroke(74, 225, 255, random(90,120));
    curveTightness(0)
    curve(0, 16, 100, 46, 150, 34, 190, 60);
    translate(40, 25);
    rotate(.05);
    stroke(94, 205, 255, random(90, 120));
    curve(0, 6, 100, 36, 150, 24, 190, 50);
    translate(30, -20);
    rotate(-.05);
    stroke(74, 215, 225, random(90, 120));
    curve(0, 6, 100, 36, 150, 24, 190, 50);
    translate(30, 15);
    rotate(.05);
    stroke(54, 235, 245, random(90, 120));
    curve(0, 6, 100, 36, 150, 24, 190, 50);
    pop();
}

//Styro - A filter-like pattern of random small lines and dots to give the underlying pattern a styrofoam feel
function styro(x, y) {
    push();
    translate(x, y);
    noStroke();
    fill(230, random(100,250));
    ellipse(random(0, 100), random(0, 100), random(1, 3), random(1,3));
    strokeWeight(random(.01, .1));
    stroke(230, random(100,250));
    line(random(0, 100), random(0, 100), random(0, 100), random(0, 100));
    pop();
}

Project-05-Wallpaper

cybergoth dragon recursion!!!

sketch

// Zoe Lin (ID: youlin)
// Section B

function setup() {
  createCanvas(400, 600);
  noLoop();
  strokeWeight(0.025);
}

function draw() {
  callDragon(5, 5, width/1.5, height/2.5, 40);

function callDragon(x, y, width, height, d){
    background(255);
    d = map(40, 0, 60, 10, 16);

    push(); //dragon1
    drawDragon(x + width/3, y-2, width, height, d);
    pop();

    push(); //dragon2
    drawDragon(x + width/3, y+height+2, width, height, d);
    pop();
  
    push(); //dragon3
    drawDragon(x + width/3, y+height*2+2, width, height, d);
    pop();
  
    //push(); //dragon4
    //drawDragon(x + width/4.5, y+height*2.5, width, height, d);
    //pop();
}

function drawDragon(x, y, width, height, d){
    
    //draw
    triangle(x , y+height/2.5, x+width/2, y, x+width, y+height/2);
    translate(x, y+height/2);
  
    push();
    dragon(width, d);
    pop();
}

function dragon(len, d) {
    if (d <= 0) {
        return;
    }

    fill(255);
    triangle(0, 0, len/2, -(len/2), len/2.5, 0);
    push();

    var newLen = len/1.4;
    rotate(- PI/4);
    fill(0);
    triangle(0, 0, newLen, 0, newLen/2.5, -(newLen/2));
    dragon(newLen, d - 1); //recursion
    pop();

    push();
    translate(len, 1.4);
    rotate(-3 * PI/4);
    fill(0);
    triangle(0, 0, newLen, 0, newLen/2.5, -(newLen/3));
    dragon(newLen, d - 1);
    pop();  
}
}

Project 05 – Wallpaper

I wanted to make a wallpaper that looked like a stitched flower quilt pattern.

sketch

//SRISHTY BHAVSAR
//15-104 PROJECT 05 
//SECTION C



// COLORS
var w = 255 // white
var lbrown = (196, 164, 132); // light brown

// lengths

var s = 50 //sqare



function setup() {
    createCanvas(200, 20);
    background(194,197,201);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    createCanvas(600,600);
    background(194,197,201); //light blue


    // RED DIAMOND LOOP
    push();
    translate(300,-300);
    rotate(radians(45)); // rotates squares to be diamonds
    for( var x = 0; x < 1200; x+= s/2) {
        for( var y = 0; y < 1200; y+= s/2){
            reddiamonds(x,y);
        } 
    }

    // FLOWER DIAMOND LOOP
    pop();
    push();
    translate(265,-300);
    rotate(radians(45));
    noFill();
    for( var i = 0; i < 2000; i+= s) {
        for( var j = 0; j < 2000; j+=s) {
            flowerdiamonds(i,j);
            //square(i,j,s);
        } 
    }

    pop();

}

function reddiamonds(x,y) {
    translate(x,y); // origin moves along row
    push();
    stroke(183, 113, 121, 70); // light red
    strokeWeight(2);
    noFill();
    square(x,y,50);
    pop();
    translate(-x,-y); // origin moves along row
}

function flowerdiamonds(i,j) {
    // lacy white dot rim of elipses that trace the diamond
    noFill();
    stroke(w);
    strokeWeight(1);
    translate(i,j);
    // create 4 lacy rims that create a square
    push();
    for (var x = 0; x < 60; x +=10) {
        for(var y = 0; y <10; y += 10) {
            ellipse(x,y, 6, 4);
        }
    }
    rotate(radians(90));
    for (var x = 0; x < 60; x +=10) {
        for(var y = 0; y <10; y += 10) {
            ellipse(x,y, 6, 4);
        }
    }

    translate(0, -50);
    for (var x = 0; x < 60; x +=10) {
        for(var y = 0; y <10; y += 10) {
            ellipse(x,y, 6, 4);
        }
    }
    translate(50,50);
    rotate(radians(-90));
    for (var x = 0; x < 60; x +=10) {
        for(var y = 0; y <10; y += 10) {
            ellipse(x,y, 6, 4);
        }
    }

    pop();

    //FLOWER STEM
    push()
    translate(-4,-30);
    rotate(radians(-40))
    noFill();
    stroke(w);
    strokeWeight(1)
    curve(6, 30, 59, 50, 60, 80, 40, 40);
    pop()


    //FLOWER PETALS
    push()
    strokeWeight(1);
    fill(196, 164, 132); // dark blue
    translate(6,6);
    ellipse(10,18,13,9);
    rotate(radians(72));
    translate(6,-30);
    ellipse(10,18,13,9);
    translate(-1,-67);
    rotate(radians(72));
    ellipse(10,18,13,9);
    rotate(radians(72));
    translate(-23,-71);
    ellipse(10,18,13,9);
    rotate(radians(72));
    translate(-8,-77);
    ellipse(10,18,13,9);
    pop()
    translate(-i,-j);

}

Project-05 Wall Paper

I want to create textile patterns inspired by traditional Chinese symbols

sketch
//Michael Li
//Section C 
var radi = 30
function setup() {
    createCanvas(755, 630);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
    background (220);

}

function draw() {
    background(30, 28, 27);

    var color = 0; //set variable color
    //create a line with the for loop
    for (var x = 0; x <= width+80; x += 4.2*radi){
        color += 1; // increment color by 1
            if (color % 2 == 1){ // test color 
                stroke(255, 204, 51); //bright yellow
            } else {
                stroke(182, 156, 129); //grey
            }
        //create a grid
        for(var y = 0; y<= height+80; y += 4.2*radi){
            color += 1;
            //test for color
            if (color % 2 == 1){
                stroke(255, 204, 51); //bright yellow
            } else {
                stroke(182, 156, 129); //grey
            }
            //two if statements in each for loop creates the alternating color pattern
            pattern1(x, y); // call to draw function pattern 1
            print(color.toString());
            
        }
    }
    //draw a grid of pattern two
    //reposition x and y initial position
    for (var x = 63; x <= width + 80; x += 4.2*radi){
        for(var y = 0; y <= height + 80; y += 4.2*radi){

        pattern2(x, y); //draw pattern 2
    }
    }
   
    noLoop();//draw once
}
    var flip1 = 1; //set varibales for  flip
    var flip2 = 1;

function pattern1(x, y){
    strokeWeight(2); 
    noFill();
    //only stroke no fill

    push();

    translate(x, y); // translate object to input x and y

    //top and bottom semi circle
    arc(0, 0, radi*2, radi*2, PI+radians(7), 0-radians(7));
    arc(0, 0, radi*2, radi*2, 0+radians(7), PI-radians(7));
    //middle long line
    line(0-radi/1.3, 0, 0+radi/1.3, 0);

    var xSpaing = 3.5;//set a uniformed spacing

    //draw the same line 4 time
    for (var i = 0; i<= 4; i += 1){
        //test which loop number it is to flip the drawing
        if (i == 1 || i == 3){
            flip1 = -flip1; //on first and third loop, flip the x position
        } else if (i == 2){
            flip2 = -flip2; //on the second loop, flip the y position
        }
        line(0-flip1*radi/1.1, 0-(flip2*6), 
        0-flip1*radi/1.5, 0-(flip2*6)); // horizontal short
        line(0+(flip1*xSpaing), 0+(flip2*radi/1.1), 
        0+(flip1*xSpaing), 0+(flip2*radi/1.3)); //verticle short 1
        line(0+(flip1*xSpaing), 0+(flip2*radi/1.8), 
        0+(flip1*xSpaing), 0+(flip2*radi/2.5)); // verticle short 2, closer to middle
        line(0+(flip1*20), 0+(flip2*radi/2.5), 
        0+(flip1*xSpaing), 0+(flip2*radi/2.5)); // horizontal longer, at 4 corners
    }

    //middle line top and bottom
    line(0+radi/2.2, 0+6, 0-radi/2.2, 0+6); //bottom middle
    line(0+radi/2.2, 0-6, 0-radi/2.2, 0-6); //top middle

    //four small arcs
    arc(0, 0, radi*1.6, radi*1.6, radians(30), radians(63));
    arc(0, 0, radi*1.6, radi*1.6, radians(85+30), radians(85+63));
    arc(0, 0, radi*1.6, radi*1.6, radians(180+30), radians(180+63));
    arc(0, 0, radi*1.6, radi*1.6, radians(265+30), radians(265+63));
    pop();

    push();
    translate(x, y); //translate to input x and y
    rotate(radians(45)); // rotate around x, y by 45 degrees
    rectMode(CENTER); //draw rect around origin
    //draw rectangle to frame the pattern
    rect(0, 0, radi*3, radi*3);
        //draw 4 times
        for(var i = 0; i<=4; i +=1){
        //test for which loop increment
        if (i == 1 || i == 3){ //first and third flip the x position
            flip1 = -flip1;
        } else if (i == 2){ //second loop flip the y position
            flip2 = -flip2;
        }
        //draw 3 small squares by the corner of the big square
        //repeat for each corner using the for loop
        rect(flip1*1.5*radi, flip2*1.5*radi, radi, radi);
        rect(flip1*1.34*radi, flip2*1.34*radi, radi/4, radi/4);
        rect(flip1*0.9*radi, flip2*1.34*radi, radi/4, radi/4);
        rect(flip1*1.34*radi, flip2*0.9*radi, radi/4, radi/4);
   }
   pop()
}


//second pattern, new arguments g and h
function pattern2 (g, h){
    push();
    translate(g, h); // translate origin to g, h
    rotate(radians(45)); //rotate around origin by 45 degrees
    rectMode(CENTER); // set rectMode
    strokeWeight(2);
    stroke(255, 204, 51, 100); // grey line color
    fill(182, 156, 129, 100); // lower transparency
    rect (1.5*radi, 1.5*radi, radi*1.8, radi*1.8); // medium size square
    pop();

    push();
    translate(g, h);
    stroke(182, 156, 129);
    rectMode(CENTER);

    rect(0, 2.1*radi, radi/3, radi/3); // small square inside

    line(0, 0,  0, height); //verticle lines
    pop();
}

SydneyCha-Project-05-Wallpaper

For this project, I wanted to create a comical wallpaper with bright colors. Here is the finished result.

sketch
//Sydney Cha
//Section D
 
function setup(){
    createCanvas(600, 600);
    background(255);
    noStroke(); 
}

function draw() {
    background(0, 150, 150);
    drawGrid();
    noLoop();
}

function drawGrid() {
    var red = 90;
    var blue = 90;
    for (var y = 0; y < height + 40; y += 40) {
        blue = 10;
        for (var x = 0; x < width + 30; x += 30) {
            fill(red, 0, blue);
            arc(x, y, 30, 80, 0, PI);
            fill(200, 200, 0);
            rect(x, y, 20, 20);
            rect(x-15, y+10, 10, 20);
            blue += 10;
        }
        red += 10;
    }
}

Project 05 – wallpaper

I wanted to make a pattern that I would actually wear: currently the patterns I am into are checkers, and I have been loving colored hearts (typically 3D and glossy) in my graphic design. I decided to combine the two together to make my wallpaper, paying attention to make the hearts are on the corners of the checkers.

sketch
function setup() {
    createCanvas(320, 320)
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}
s=40;
function draw () {
    rectMode (CORNER);
    for (var row = 0; row <8; row +=1) {
        for (var col = 0; col <8; col += 1) {
            fill (((row+col)%2) *255);
            rect (col*40, row*40, 40, 40);
        }
    }
    for (x = 0; x < width+80; x += s) {
    for (y = 0; y < height+40; y += s) {
      fill(310*x/width, 100, 255);
      heart(x+s/2-20, y+s/2-30, s/2);

    }
  }
}

function heart(x, y, size) {
  beginShape();
  vertex(x, y);
  bezierVertex(x - size / 2, y - size / 2, x - size, y + size / 3, x, y + size);
  bezierVertex(x + size, y + size / 3, x + size / 2, y - size / 2, x, y);
  endShape(CLOSE);
}


initial sketch of my wallpaper

Project 05: Wallpaper

sketch
//amyhu
//amyhu@andrew.cmu.edu
//section d
//project 05

var s = 100

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

function draw() {
    //first column 
    for(let y = 0; y <= 600; y += 100){
        for(let x = 0; x <=600; x += 200){
            drawSquare(x,y);
        }
    }

    //offset column
    for(let y = -s/2; y <= 600; y += 100){
        for(let x = s; x <=600; x += 200){
            drawSquare(x,y);
        }
    }
}



function drawSquare(x,y){
    fill(50,10,40);
    noStroke();
    square(x,y,s);


    fill(130,2,99);
    arc(x+s,y,s,s,(radians(90)),-(radians(180)));
    fill(217,3,104);
    arc(x,y,s,s,0,(radians(90)));
    fill(234,222,218)
    arc(x,y+s,s,s,(radians(270)),(radians(0)));
    fill(46,41,78);
    arc(x+s,y+s,s,s,(radians(180)),(radians(270))); 
}

//offseted column
// function drawSquares(a,b){
//     fill(240);
//     square(x,y,s);
//     fill("red"); 
//     arc(x+s,y,s,s,(radians(90)),-(radians(180)));
//     arc(x,y,s,s,0,(radians(90)));
//     arc(x,y+s,s,s,(radians(270)),(radians(0)));
//     arc(x+s,y+s,s,s,(radians(180)),(radians(270))); 
// }

Project 5: Wallpaper

sketchDownload
//Alicia Kim
//Section B
//yoonbink@andrew.cmu.edu
//Project-05

function setup() {
    createCanvas(420, 420);
    background(175,238,238);
}

function draw() {
    for (r=0;r<8;r++){
        for(c=0;c<8;c++){
            if (r%2==0 & c%2==0){
                drawFlower(r*60,c*60,255,209,193);
            }
            else{
                drawFlower(r*60,c*60,255,250,245);
            }
            
        }
    }
    noLoop();
}


function drawFlower (x,y,fillR,fillG,fillB) {
    
// leaves
    push();
    noStroke();
    translate(x+30,y+25);
    var randomR=floor(random(360));
    for (var j=0;j<3;j++){
        
        fill(144,238,144); //light green
        rotate(radians(randomR));
        ellipse(13,13,10,20);     
    }
    pop();

// stem
    push();
    noStroke();
    translate(x+30,y+25);
    var randomS=floor(random(360));
    fill(60,179,113,191); //sea green
    rotate(radians(randomS));
    rect(13,13,12,4.5);
    print(randomS);
    
    pop();

// flower petals
    push();  
    noStroke();
    translate(x+30,y+25);
    fill(fillR,fillG,fillB); // lavender blush
    var petal = floor(random(3,7));
    for (var i=0 ; i<petal ;i++){    
        ellipse(0,0,25,50);
        rotate(2*PI/petal);    
    }
    pop();
    noLoop();

// circle in the middle
    push();
    noStroke();
    fill(249,139,136); //pink
    circle (x+28,y+28,20);
    fill(255,209,193); //peach
    circle(x+30,y+25,12);
//small circles
    fill(128,128,0); //olive
    circle(x+28,y+23,4);
    circle(x+32,y+25,3);
    circle(x+28,y+28,4.5);
    circle(x+29,y+27,2.5);
    circle(x+23,y+23,3);

    pop();

}