project-6 – [OLD SEMESTER] 15-104 • Introduction to Computing for Creative Practice https://courses.ideate.cmu.edu/15-104/f2022 Professor Tom Cortina • Fall 2022 • Introduction to Computing for Creative Practice Mon, 10 Oct 2022 00:52:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.8 Project 6 – Abstract Clock https://courses.ideate.cmu.edu/15-104/f2022/2022/10/09/project-6-abstract-clock-4/ https://courses.ideate.cmu.edu/15-104/f2022/2022/10/09/project-6-abstract-clock-4/#respond Mon, 10 Oct 2022 00:50:51 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=74160 Continue reading "Project 6 – Abstract Clock"]]>

I created an ice cream clock. The scoops run on standard time rather than military time so for every hour, a scoop is added. At 12 pm there is no scoop and it resets. For every second, a new sprinkle falls to the bottom and the chocolate ice cream slowly changes to a raspberry color. With every minute, the ice cream puddle at the bottom of the canvas gets larger ( as if its rising).

sketch
// SRISHT BHAVSAR
// SECTION C 15-104
// PROJECT 6

var diam = 30; // scoop diam
var h; //hours 
var m; //min
var s; //second

var c = [];

function setup() {
    createCanvas(200, 20);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
    for (var i=0; i < 60; i++)  {
        c[i] = color(random(255), random(255), random(255));
    } 
}

function draw() {
    createCanvas(480, 480);
    background('lightblue'); // light blue

    let h = hour();
    let m = minute();
    let s = second();


    //minutes equals height of puddle
    translate(0,0)
    stroke(210, 180, 140);
    fill('beige');
    rect(0,480,480,-(m));


    push()
    noStroke();
    translate(500,510);
    rotate(radians(180));
    for (var i = 0; i < diam ; i+= diam) {
        for (var j = 0; j < (h-12) * diam ; j+= diam) { // instead of military time, it is 12 hr time
            
            if ( j % 4 == 0) {
                fill(98 + s,52,18+s); // chocolate// changes color by second
            }

            if ( j % 4 == 1) {
                fill('beige'); // vanilla

            }

            if ( j % 4 == 2) {
                fill('lightpink'); // strawberry
            }


            circle(250,j+150,diam); // scoop

        }
    }
    pop();


// ice cream cone w month and date
    push();
    fill(210, 180, 140);
    strokeWeight(5);
    stroke('beige');
    translate(150,320);
    scale(.5);
    triangle(155,100,203,300,245,100); 
    pop();



// ice cream sprinkles are seconds
    push();
    fill(c[i])
    scale(0.8);

    for(var i =0; i < 4; i+= 4){
        for(var j = 0; j < (s*10); j+= 7) {
            ellipse(310, j, 3, 5);
        }
    }
    pop();
    frameRate(1);

} 



]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/10/09/project-6-abstract-clock-4/feed/ 0
Project 06 https://courses.ideate.cmu.edu/15-104/f2022/2022/10/07/project-06/ https://courses.ideate.cmu.edu/15-104/f2022/2022/10/07/project-06/#respond Sat, 08 Oct 2022 02:59:39 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=73858
sketchDownload
// Ilia Urgen
// Section B
// iurgen@andrew.cmu.edu
// Project-06

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

function draw() { 
    // 0:00 to 8:00
    if (hour() >= 0 & hour() <= 8) {
        sleep(); 
    }

    // 8:00 to 20:00
    else if (hour() >= 8 & hour() <= 20) {
        daytime();
    }

    // 20:00 to 24:00
    else if (hour() >= 20 & hour() <= 24) {
        sleep();
    }

}

// 0:00 to 8:00 and 20:00 to 24:00
function sleep() {
    
    var s = map (minute(), 0, 60, 0, 3600) + second();
    var c = map (hour(), 0, 20, 0, 70);
    var h = map (s, 0, 3600, 0, 90);

    
    color_1 = color (120,29,173);
    color_2 = color (0);

    // ombre 
    for (var y = 0; y < height; y++ ) {
        n = map (y,0, height, 0, 1);
        var color_3 = lerpColor (color_1, color_2, n);
        stroke (color_3);
        line (0, y, width, y);
    }

    stroke (0);
    strokeWeight (8);

    // canvas border lines
    line (1,1,1,449);
    line (1,1,449,1);
    line (1,449,449,449);
    line (449,1,449,449); 

    // window
    fill (11,11,10 + c);
    rect (width/2, height/2 - 180, 200, 200);

    // moon
    noStroke();
    fill (230,230,180);
    ellipse (320,120,100,100);
    fill (11,11,10 + c);
    ellipse (375 - h,120,95,110);

    // bed
    fill (152,118,84);
    strokeWeight (0.5);
    rect (width/2 - 200, height/4 + 210, 300, 100);
    rect (width/2 - 200, height/4 + 310, 40, 40);
    rect (width/2 + 60, height/4 + 310, 40, 40);

    // hair on head
    fill (255);
    ellipse (280,315,100,40);

    // pillow
    fill (0);
    ellipse (280,300,70,45);

    //blanket
    strokeWeight (2);
    fill (123,24,26);
    square (width/2 - 200, height/4 + 170, 50);
    square (width/2 - 150, height/4 + 220, 50);
    square (width/2 - 100, height/4 + 170, 50);
    square (width/2 - 50, height/4 + 220, 50);
    square (width/2, height/4 + 170, 50);
    square (width/2 - 200, height/4 + 270, 50);
    square (width/2 - 100, height/4 + 270, 50);
    square (width/2, height/4 + 270, 50);

    fill (0,65,169);
    square (width/2 - 200, height/4 + 220, 50);
    square (width/2 - 150, height/4 + 170, 50);
    square (width/2 - 100, height/4 + 220, 50);
    square (width/2 - 50, height/4 + 170, 50);
    square (width/2, height/4 + 220, 50);
    square (width/2 - 150, height/4 + 270, 50);
    square (width/2 - 50, height/4 + 270, 50);
    
    // Flickering Zzz's
    zzz();
}

function zzz() {
    
    if (second () % 2 == 0) {
        stroke (255);
        strokeWeight (4);
        line (280,270,320,270);
        line (280,230,320,230);
        line (280,270,320,230);

        push();
        translate (40, -20);
        line (280,270,320,270);
        line (280,230,320,230);
        line (280,270,320,230);
        pop();

        push();
        translate (80, -40);
        line (280,270,320,270);
        line (280,230,320,230);
        line (280,270,320,230);
        pop();
    }   
}

// 8:00 to 20:00
function daytime () {
    
    var s = map (minute (), 0, 60, 0, 3600) + second();
    var m = floor (map (minute (), 2, 60, 2, 10));
    var x = map (s, 0, 3600, 0, 340);
    var c = map (hour (), 3, 20, 0, 100);
    
    
    color_1 = color (25,206,255 - m);
    color_2 = color (0,129,150 - m);

    // ombre
    for (var y = 0; y < height; y++ ) {
        n = map (y,0, height, 0, 1);
        var color_3 = lerpColor (color_1, color_2, n);
        stroke (color_3);
        line (0, y, width, y);
    } 
    
    // moving clouds
    noStroke();
    fill (255);
    circle (300 + c,120,50);
    circle (300 + c,90,50);
    circle (340 + c,120,50);
    circle (340 + c,90,50);
    circle (282 + c,105,50);
    circle (358 + c,105,50);
    
    push();
    translate (72,80);
    circle (300 + c,120,50);
    circle (300 + c,90,50);
    circle (340 + c,120,50);
    circle (340 + c,90,50);
    circle (282 + c,105,50);
    circle (358 + c,105,50);
    pop();

    stroke (0);
    strokeWeight (8);
    
    // walls
    noFill();
    rect (width/2, height/2 - 180, 200, 200);
    
    fill (255,127,80);
    noStroke();
    rect (0, height/6 - 80, 221, 260);
    rect (height/2 - 12, 0, 240, 41);
    rect (0, height/2 + 24, width, 202);
    rect (height/2 + 204, 0, 22, 300);

    
    // countertop
    fill (255);
    rect (0,width/2 + 24, width, 30);

    // cabinets
    fill (86,60,40);
    rect (0,width/2 + 48, width, 200);

    stroke (0);
    noFill();
    strokeWeight (2);
    rect (28,width/2 + 72, 80, 140);
    rect (132,width/2 + 72, 80, 140);
    rect (236,width/2 + 72, 80, 140);
    rect (340,width/2 + 72, 80, 140);

    // doorknobs
    noStroke();
    fill (212,175,55);
    circle (90,330,20);
    circle (150,330,20);
    circle (300,330,20);
    circle (360,330,20);

    strokeWeight (8);

    // canvas border lines
    line (1,1,1,449);
    line (1,1,449,1);
    line (1,449,449,449);
    line (449,1,449,449);

    // "GOOD"
    if (second () % 2 == 0) {
        
        push();
        translate (20,40);
        stroke (0);
        strokeWeight (4);
        line (20,20,40,20);
        line (20,20,20,60); 
        line (20,60,40,60);
        line (40,60,40,40); 
        line (40,40,30,40); 

        line (60,20,80,20);
        line (60,20,60,60); 
        line (60,60,80,60);
        line (80,60,80,20);

        push();
        translate (40,0);
        line (60,20,80,20);
        line (60,20,60,60); 
        line (60,60,80,60);
        line (80,60,80,20); 
        pop();

        line (140,20,140,60);
        line (140,20,160,40);
        line (140,60,160,40);
        pop();

    }

    // "DAY!!!"
    if (second () % 2 == 1) {
        
        push();
        translate (20,40);
        stroke (0);
        strokeWeight (4);
        line (20,80,20,120);
        line (20,80,40,100);
        line (20,120,40,100);
        
        line (60,80,80,80);
        line (60,80,60,120); 
        line (60,100,80,100);
        line (80,120,80,80); 

        line (100,80,110,100); 
        line (110,100,120,80); 
        line (110,100,110,120); 

        line (140,80,140,110);
        line (150,80,150,110);
        line (160,80,160,110);

        point (140,120);
        point (150,120);
        point (160,120);
        pop();
    }  
}
]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/10/07/project-06/feed/ 0