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
}

Leave a Reply