Project 04: String Art Pizza

I made a pizza, a box, and a sun. I’m not really sure where I was going with this but I ate pizza.

sketch
//Kaitlyn Chow
//kachow
//Section A

var dx1;
var dy1;
var numLines= 20;
var starLines= 8;
var angle=0;
var boxLines=40;



function setup() {
    createCanvas(400, 300);
    background(220);
    dx1= (30-50)/ numLines;
    dy1= (150-50)/ numLines;
    dyBox= (100)/ boxLines;


}

function draw() {
    //Shape 1 pizza: Lines from pizza left to the point (200, 170)
    stroke(250, 245, 202);
    line(50, 50, 30, 150);   //pizza left side
    line(30, 150, 200, 160); //pizza right bottom
    line(200, 160, 50, 50);  //pizza right top
    var x1= 50;
    var y1= 50;
    for(var p=0; p<= numLines; p+=1){
        line (x1, y1 , 200, 160);
        x1+= dx1;
        y1+= dy1;

    }
    //crust & toppings
    stroke(183, 137, 70);
    strokeWeight(5);
    line(50, 50, 30, 150);

    noStroke();
    fill(255, 0, 0);
    circle (75, 100, 20);
    circle (75+20, 140, 20);
    circle (75+20+30, 120, 20);



    //shape 2 sun: each time, line x and y position changes
    stroke(1);
    strokeWeight(1);
    var xStar= 300;
    var yStar= 50;
    for(var s=0; s<=starLines; s+=1){
        push();
        translate(300, 50);
        rotate(radians(angle));
        angle+=2
        line(s, 0, s, 50);
        pop();
    }


    //shape 3 pizza box:
    noFill();
    push();
    translate(200, 175); //location of box
    rect(0, 0, 100, 100);
    //left side(0, 0, 0, 100);
    //right side(100, 0, 100, 100);

    //box design
    stroke(78, 52, 46);
    var x1Box=0;
    var y1Box=0;
    var x2Box=100;
    var y2Box=100;
    for(var a=0; a<=boxLines; a+=1){
        line(x1Box, y1Box, x2Box, y2Box);
        y1Box+=dyBox
        y2Box-=dyBox

        //line colors
        if(a%2==1){
            stroke(78, 52, 46); //dark brown
        }
        else{
            stroke(156, 90, 5); //caramel brown
        }

    }

    pop()





}

Leave a Reply