Uncategorized – [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, 21 Nov 2022 04:28:43 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.8 Bhaboo’s Looking Outwards – Week 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/bhaboos-looking-outwards-week-11/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/bhaboos-looking-outwards-week-11/#respond Mon, 21 Nov 2022 04:28:43 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=76142 Continue reading "Bhaboo’s Looking Outwards – Week 11"]]>

For this weeks looking outwards, I really enjoyed looking into the societal impacts that digital art has has on our world. It was interesting to see that there are so many possible issues that can arise when it comes to digital art. I decided to look into NFTs, or non-fungible tokens, and how copyright affects them. We all hear about copyright all around us, especially with the rise of brands and products that want to differentiate themselves. However, I didn’t really know that there were copyright implications with NFT’s. Since NFT’s are based around artwork, it’s essential to hold rights to the art. It was interesting to see how auction sites that host NFT’s are starting to create “DMCA” processes for removing these unauthorized NFT’s. I’m glad to see that there are processes in place to protect people’s hard work.

Link: https://www.plagiarismtoday.com/2021/03/16/nfts-and-copyright/

]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/bhaboos-looking-outwards-week-11/feed/ 0
Srishty’s Project 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/srishtys-project-11/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/srishtys-project-11/#respond Mon, 21 Nov 2022 02:27:50 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=76052 Continue reading "Srishty’s Project 11"]]>

The Sushi Bar Train

For my project I decided to create a restaurant on a train that serves japanese food via a conveyer belt. The dishes include: sashimi, tuna sushi, matcha, miso soup, ramen, and salmon. In the window of the train booth, you can watch as you travel through a bright city at night.

Sushi Bar TrainDownload

// SRISHTY BHAVSAR 
// 15104 SECTION C
//PROJECT 11

var buildings = [];

var fd = [] // 

// food items
var ramen; // https://imgur.com/H2R30Wg
var miso; // https://imgur.com/J5EhmuM
var salmon; // https://imgur.com/p6YrdLv
var sashimi;  // https://imgur.com/mJjnmVD
var matcha; // https://imgur.com/SErtIMf
var tunasushi; // https://imgur.com/HCUsYNh
var maki; // https://imgur.com/UI5eghR

var food = 
["https://i.imgur.com/H2R30Wg.png", "https://i.imgur.com/J5EhmuM.png", 
 "https://i.imgur.com/p6YrdLv.png", "https://i.imgur.com/mJjnmVD.png", 
 "https://i.imgur.com/SErtIMf.png" , "https://i.imgur.com/HCUsYNh.png", 
 "https://i.imgur.com/UI5eghR.png"]; // food contains the images of ramen,miso,salmon,etc.


function preload() {

    seats = loadImage("https://i.imgur.com/UEAssld.png");


    ramen = loadImage(food[0]); //ramen
    miso = loadImage(food[1]); //miso
    salmon = loadImage(food[2]); // salmon
    sashimi = loadImage(food[3]); //sashimi
    matcha = loadImage(food[4]); //matcha
    tunasushi = loadImage(food[5]); //tunasushi
    maki = loadImage(food[6]); //maki



    bg = loadImage("https://i.imgur.com/2zjN6qS.png");

}

function setup() {
    createCanvas(480, 480);
    background(220);
    imageMode(CENTER);
    frameRate(17);

    // create an initial collection of buildings
    for (var i = 0; i < 20; i++) {
        var rx = random(width);
        buildings[i] = makeBuilding(rx);
        
    }


    // collection of dishes
    var dist = 0;
    for (var i = 0; i <500; i++) {
        fd[i] = makeFood(dist);
        dist += 150; //distance between dishes
    }
    print(fd);

}

function draw() {
    createCanvas(480, 480);
    background(25,25,112);


    //buildings
    push();
    translate(0,-120);
    updateAndDisplayBuildings();
    removeBuildingsThatHaveSlippedOutOfView();
    addNewBuildingsWithSomeRandomProbability(); 
    pop();

    //bg
    image(bg, 266.4269, 240, 532.8539, 480);

    showFood();

    //seats
    image(seats,240,408.3845,480,143.231);




}


function makeFood(xloc){
    var fd = { x: xloc,
                speedx: 1.5,
                move: foodMove, 
                food : random([ramen, miso, salmon, sashimi, matcha, tunasushi, maki]),
                display: foodDisplay,
                }
    return fd;
}


function foodDisplay(){

    /*the width heights and y location are respective to the 
    ones mapped out on adobe illustrator. thats why they are typed manually */
    //xloc is the speed times 500 and the dist
    if (this.food == ramen){
        image(ramen,this.x -750*20, 310, 148, 108 );  // ramen
    }
    if (this.food == miso){
        image(miso,this.x  -750*20, 310, 119, 115 ); // miso
    }
    if (this.food == salmon){
        image(salmon,this.x -750*20, 318, 174, 126 ); // salmon
    }
    if (this.food == sashimi){
        image(sashimi,this.x -750*20, 309, 203, 147 ); //sashimi
    }
    if (this.food == matcha){
        image(matcha,this.x - 750*20, 324, 119, 86 ); // matcha
    }
    if (this.food == tunasushi){
        image(tunasushi,this.x  -750*20, 318, 164, 119); //tuna
    }
    if (this.food == maki){
        image(maki,this.x  -750*20, 294, 247, 179 ); //maki
    }
}

//speed of moving food
function foodMove() {
    this.x += this.speedx;  
}

//calling show and move function of dishes
function showFood(){
    for( var i = 0; i < fd.length; i++ ) {
        fd[i].display();
        fd[i].move();
        if ( i == fd.length){
            textSize(15);
            text('Sushi Bar closed. No more food for today!', 100, 200);
        }
    }

}



function makeBuilding(birthLocationX) {
    var bldg = {x: birthLocationX,
                breadth: 30,
                speed: -1.0,
                nFloors: round(random(2,8)),
                move: buildingMove,
                color: color(random(255),random(255), random(255), 80), // random color buildings with low opacity to look distant
                display: buildingDisplay
            } 
    return bldg;
}


function updateAndDisplayBuildings(){
    // Update the building's positions, and display them.
    for (var i = 0; i < buildings.length; i++){
        buildings[i].move();
        buildings[i].display();
    }
}


function removeBuildingsThatHaveSlippedOutOfView(){

    var buildingsToKeep = [];
    for (var i = 0; i < buildings.length; i++){
        if (buildings[i].x + buildings[i].breadth > 0) {
            buildingsToKeep.push(buildings[i]);
        }
    }
    buildings = buildingsToKeep; // remember the surviving buildings
}


function addNewBuildingsWithSomeRandomProbability() {
    // With a very tiny probability, add a new building to the end.
    var newBuildingLikelihood = 0.007; 
    if (random(0,1) < newBuildingLikelihood) {
        buildings.push(makeBuilding(width));
    }
}


// method to update position of building every frame
function buildingMove() {
    this.x += this.speed;
}
    

// draw the building and some windows
function buildingDisplay() {
    var floorHeight = 20;
    var bHeight = this.nFloors * floorHeight; 
    fill(this.color); 
    push();
    translate(this.x, height - 40);
    strokeWeight(0);
    rect(0, -bHeight, this.breadth, bHeight);
    for (var i = 0; i < this.nFloors; i++) {
        rect(5, -15 - (i * floorHeight), this.breadth - 10, 10);
    }
    pop();
}



]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/20/srishtys-project-11/feed/ 0
Project-11-Landscape https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/project-11-landscape-2/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/project-11-landscape-2/#respond Sat, 19 Nov 2022 21:08:13 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75849 Continue reading "Project-11-Landscape"]]>

I take references from this animation/rendering competition and made this robot pushing a sphere in an alien planet:

I have trees generation in the background

boulders in front

and hills in the back

/*
 * Andrew J Wang
 * ajw2@andrew.cmu.edu
 * Section A
 *
 * This Program is walking
 */

//sets of links

//location of feets of the walking person
var pointXG = 0;
var pointYG = 0;

//steps (frame) locations of the feets
var stepsX = [0,1,2,3,4,5,6,7,8,9,10,10,10,10,10,10,9,8,7,6,5,4,3,2,1,0];
var stepsY = [0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0];

//counters for multiple frames (feet + mountains)
var counter = 0;

//location of the person on the drawing
var locationX = 120;
var locationY = 200;

//arrays for trees for clusters of boulders 
var trees = [];
var clusters = [];

//set a array for land heights (FROM PREVIOUS ASSIGNMENT)
var landHeight = [];
var landHeight2 = [];

//create noice parameter and steps
var noiseParam = 0;
var noiseParam2 = 0;
var noiseStep = 0.005;
var noiseStep2 = 0.01;

function setup() {
    createCanvas(480,300);
    // create an initial collection of trees
    for (var i = 0; i < 5; i++){
        var rx = random(width);
        trees[i] = makeTrees(rx);
    }

    // create an initial collection of boulders
    for (var i = 0; i < 10; i++)
    {
        var rx2 = random(width);
        clusters[i] = makeClusters(rx2);
    }

    //hill #1
    for (var k=0; k<=480; k++)
    {   
        //get noise through noise param
        var n = noise(noiseParam);
        //remapping based on height
        var value = map(n,0,1,0,height/4)+130;
        //add to array
        landHeight.push(value);
        //plus steps
        noiseParam += noiseStep;
    }

    //hill #2
    for (var k=0; k<=480; k++)
    {   
        //get noise through noise param
        var n2 = noise(noiseParam2);
        //remapping based on height
        var value2 = map(n2,0,1,0,height/3)+80;
        //add to array
        landHeight2.push(value2);
        //plus steps
        noiseParam2 += noiseStep2;
    }

}


function draw() {
    background(100);

    //MOON
    push();
    noStroke();
    fill(255,255,220);
    ellipse(380,0,250,250);
    pop();

    //draw first sets of hill
    push();
    noStroke();
    fill(240);
    beginShape();
    //fist vertex
    vertex(0,(locationY+70+60)*0.8-80);
    //for loop to grab all the vertex
    for (var k=0; k<=480; k++)
    {   
    vertex(k,landHeight2[k]);
    }
    //last vertex
    vertex(width,(locationY+70+60)*0.8-80);
    endShape(CLOSE);
    //adding another point by shifting
    var n2=noise(noiseParam2);
    var value2 = map(n2,0,1,0,height/3)+80;
    noiseParam2 += 0.01/20;
    //slowing the speed of refreshing by using a counter
    if (counter%40==0)
    {
        landHeight2.shift();
        landHeight2.push(value2);
    }
    pop();

    //draw second sets of hill
    push();
    noStroke();
    fill(220);
    beginShape();
    //fist vertex
    vertex(0,(locationY+70+60)*0.8-80);
    //for loop to grab all the vertex
    for (var k=0; k<=480; k++)
    {   
    vertex(k,landHeight[k]);
    }
    //last vertex
    vertex(width,(locationY+70+60)*0.8-80);
    endShape(CLOSE);
    //adding another point by shifting
    var n=noise(noiseParam);
    var value = map(n,0,1,0,height/4)+130;
    noiseParam += 0.005/5;
    //slowing the speed of refreshing by using a counter
    if (counter%10==0)
    {
        landHeight.shift();
        landHeight.push(value);
    }
    pop();

    //ground plane
    push();
    noStroke();
    fill(200);
    rect(0,(locationY+70+60)*0.8-80,width, height-((locationY+70+60)*0.8-80));
    pop();

    //set trees and clusters by refreshing the removed objects and clusters
    updateDisplay();
    removeTrees();
    addTrees();
    removeClusters();
    addClusters();

    //walking person
    strokeWeight(3);
    push();

    //scaling it
    scale(0.6);
    translate(0,150);
    walking(locationX,locationY);
    walking2(locationX,locationY);
    body(locationX,locationY);

    //butt
    push();
    strokeWeight(2);
    ellipse(locationX,locationY,15,15);
    pop();
    pop();

    //display clusters in the end
    updateDisplay2();

}


//refreashing trees and display them
function updateDisplay(){
    for (var i = 0; i < trees.length; i++){
        trees[i].move();
        trees[i].display();
    }
}

//refreshing boulders and display them
function updateDisplay2(){
    for (var i = 0; i < clusters.length; i++){
        clusters[i].move();
        clusters[i].display();
    }
}

//removing trees if it is too far away from the screen
function removeTrees(){
    var treesToKeep = [];
    for (var i = 0; i < trees.length; i++){
        if (trees[i].x + trees[i].breadth > 0) {
            treesToKeep.push(trees[i]);
        }
    }
}

//removing boulders if it is too far away from the screen
function removeClusters(){
    var clustersToKeep = [];
    for (var i = 0; i < clusters.length; i++){
        if (clusters[i].x + clusters[i].breadth > 0) {
            clustersToKeep.push(clusters[i]);
        }
    }
}

//add trees 100 units away from border
function addTrees() {
    var Likelihood = 0.01; 
    if (random(0,1) < Likelihood) {
        trees.push(makeTrees(width+100));
    }
}

//add boulders 500 units away from border
function addClusters() {
    var Likelihood = 0.01; 
    if (random(0,1) < Likelihood) {
        clusters.push(makeClusters(width+500));
    }
}

//set trees values and function
function makeTrees(birthLocationX) {
    var tree = {x: birthLocationX,
                breadth: 100,
                speed: -0.4,
                y: 160+round(random(20)),
                treeHeight: round(random(40,50)),
                size: round(random(30,50)),
                move: objectMove,
                display: treeDisplay}
    return tree;
}

//set boulders values and functions
function makeClusters(birthLocationX) {
    var tree = {x: birthLocationX,
                breadth: 100,
                speed: -2.0,
                treeHeight: round(random(40,50)),
                size: round(random(200,350)),
                move: object2Move,
                display: clusterDisplay}
    return tree;
}

//move objects 
function objectMove() {
    this.x += this.speed;
}

function object2Move() {
    this.x += this.speed;
}

//draw trees
function treeDisplay() {
    line(this.x, this.y , this.x, this.y+this.treeHeight);

    push();
    translate(this.x,this.y);
    rectMode(CENTER);
    noFill();
    strokeWeight(1);

    push();
    rotate(-counter/180*Math.PI);
    rect(0,0,this.size,this.size);
    pop();

    push();
    rotate(counter/180*Math.PI);
    rect(0,0,this.size-10,this.size-10);
    pop();


    pop();
}

//draw bolders
function clusterDisplay() {
    push();
    fill(0);
    ellipse(this.x,height+30,this.size,this.size/2);
    strokeWeight(1.5);
    noFill();
    ellipse(this.x,height+30,this.size+20,this.size/2+10);
    pop();
}

//leg #1
function walking(xL,yL)
{   
    //counter/10 get frame number
    var counterK = Math.floor(counter/10)%(stepsX.length);

    //Feet locations
    pointXG = xL-70+stepsX[counterK]*6;
    pointYG = yL+70-stepsY[counterK]*4;

    //Pathegorean theorm to get the knee and legs
    var dis = Math.sqrt((xL-pointXG)*(xL-pointXG)+(yL-pointYG)*(yL-pointYG));
    var num = (10000)-(dis*dis);
    var sid = sqrt(num);
    var midX = xL-(xL-pointXG)/2;
    var midY = yL-(yL-pointYG)/2;
    var tan = atan2(pointXG-xL,pointYG-yL);
    ellipse ((pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2, 5,5);
    line(xL,yL,(pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2);
    line(pointXG,pointYG,(pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2);

    //feet bending
    if (stepsY[counterK]==0)
    {
        line(pointXG,pointYG,pointXG+20,pointYG);
    }
    else
    {
        var tanF = atan2(Math.sqrt(400-stepsY[counterK]*2),stepsY[counterK]*4);
        line(pointXG,pointYG,pointXG+20*sin(tanF),pointYG+20*cos(tanF));
    }

    counter++;
}

//repeat for the second leg
function walking2(xL,yL)
{   
    var counterK = (Math.floor(counter/10)+stepsX.length/2)%(stepsX.length);
    pointXG = xL-70+stepsX[counterK]*6;
    pointYG = yL+70-stepsY[counterK]*4;
    var dis = Math.sqrt((xL-pointXG)*(xL-pointXG)+(yL-pointYG)*(yL-pointYG));
    var num = (10000)-(dis*dis);
    var sid = sqrt(num);
    var midX = xL-(xL-pointXG)/2;
    var midY = yL-(yL-pointYG)/2;
    var tan = atan2(pointXG-xL,pointYG-yL);
    ellipse ((pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2, 5,5);
    line(xL,yL,(pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2);
    line(pointXG,pointYG,(pointXG-xL)/2+xL+cos(tan)*sid/2, (pointYG-yL)/2+yL-sin(tan)*sid/2);
    if (stepsY[counterK]==0)
    {
        line(pointXG,pointYG,pointXG+20,pointYG);
    }
    else
    {
        var tanF = atan2(Math.sqrt(400-stepsY[counterK]*2),stepsY[counterK]*4);
        line(pointXG,pointYG,pointXG+20*sin(tanF),pointYG+20*cos(tanF));
    }

    counter++;

}

//body parts and other stuff
function body(xL,yL)
{
    var counterK = (Math.floor(counter/10)+stepsX.length/2)%(stepsX.length);
    var counterK2 = (Math.floor(counter/10)+10)%(stepsX.length);
    var counterK3 = (Math.floor(counter/10)+25)%(stepsX.length);
    push();
    strokeWeight(2);
    fill("grey")
    //shoulder 1
    ellipse(xL+35+stepsY[counterK2],yL-45-stepsX[counterK2],30,30);

    //hand
    ellipse(xL+35+60,yL-45-stepsX[counterK]+10,10,10);
    pop();

    //arms
    line(xL+35+stepsY[counterK],yL-45-stepsX[counterK],xL+35+30,yL-45-stepsX[counterK]+20);
    line(xL+35+30,yL-45-stepsX[counterK]+20,xL+35+60,yL-45-stepsX[counterK]+10);

    //body
    line(xL,yL,xL+35+stepsY[counterK],yL-45-stepsX[counterK]);

    push();
    fill("black");
    ellipse(xL+35+30,yL-45-stepsX[counterK]+20,5,5);
    pop();

    //Round thingy
    push();
    noFill();
    strokeWeight(2);
    ellipse(xL+35+175,yL-45,230,230);
    fill(255);
    ellipse(xL+35+175,yL-45,220,220);

    stroke(255);

    pop();


    //shoulder 2
    push();
    noStroke();
    ellipse(xL+35+stepsY[counterK2],yL-45-stepsX[counterK2],15,15);
    pop();

    //head
    push();
    strokeWeight(1);
    noFill();
    translate(xL+55+stepsY[counterK3],yL-85-stepsX[counterK3]);
    rectMode(CENTER);
    rotate(-counter/180*Math.PI);
    rect(0,0,40,40);
    rect(0,0,30,30);
    pop();

    push();
    strokeWeight(1);
    noFill();
    translate(xL+65+stepsY[counterK2]*2,yL-95-stepsX[counterK2]);
    rectMode(CENTER);
    rotate(counter/180*Math.PI);
    rect(0,0,25,25);
    rect(0,0,30,30);
    pop();

    push();
    strokeWeight(1);
    noFill();
    translate(xL+45+stepsY[counterK]*2,yL-75-stepsX[counterK]);
    rectMode(CENTER);
    rotate(counter/180*Math.PI);
    rect(0,0,25,25);
    rect(0,0,15,15);
    pop();

}





]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/project-11-landscape-2/feed/ 0
Looking Outwards – 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/looking-outwards-11-8/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/looking-outwards-11-8/#respond Sat, 19 Nov 2022 21:00:36 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75845 Continue reading "Looking Outwards – 11"]]>

Link: https://www.plagiarismtoday.com/2021/03/16/nfts-and-copyright/

By reading this article, I understand how NFTs really work. So, according to this article owning an NFT doesn’t necessarily mean someone actually owns the copyright of this art piece. However, it isn’t completely useless, as NFTs can also be considered as an internet-signed copy of the work. Because of the fact that the NFTs function as a signed copy of the original art piece, they can help the producers financially. On the other hand, some people who didn’t create those works can also tokenize those works can really damage the career of the artists who actually created those works. In other words, NFT platforms not only provide an easier way to allow society to donate and help digital artists but also create an opportunity for those who are even involved in any art creation process to drain money from those creators. However, in a few years, courts will eventually be involved in such cases to protect those artists eventually. 

CITATION:

Bailey, J. (2021, March 16). NFTs and copyright. Plagiarism Today. Retrieved November 19, 2022, from https://www.plagiarismtoday.com/2021/03/16/nfts-and-copyright/ 

]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/19/looking-outwards-11-8/feed/ 0
Looking Outwards 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/18/looking-outwards-11-6/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/18/looking-outwards-11-6/#respond Sat, 19 Nov 2022 03:22:07 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75821 Continue reading "Looking Outwards 11"]]>
Gender Shades

https://ars.electronica.art/aeblog/en/2020/04/10/women-in-media-arts-ai/

As artificial intelligence software that detects, recognizes, and classifies faces becomes increasingly popular, researchers Joy Buolamwini and Timnit Gebru are examining how codified biases in facial recognition software often misgender people who are not white or even fail to recognize their faces completely in their project titled “Gender Shades”. These biased facial recognition softwares are often created by male-dominated teams of computer scientists who lack diversity in ethnicity, race, and gender. Additionally, the data sets that these computer scientists feed their programs also often lack diversity, which is why the software does a poor job of recognizing people who are not white or male. To combat this, Buolamwini and Gebru have created a new standard of data set taken from a diverse group of 1270 parliamentarians from Africa and Europe. This new benchmark dataset for gender and racial diversity will help facial recognition softwares learn to recognize all faces and distinguish between genders and ethnicities without bias.

]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/18/looking-outwards-11-6/feed/ 0
Project 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/17/project-11/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/17/project-11/#respond Fri, 18 Nov 2022 00:57:18 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75786 Continue reading "Project 11"]]>

Scrolling environment in space

sketch
//PLANET VARIABLES:
var numPlanets = 4;
var planet = {x: [], y: [], s: [], r: [], g: [], b: [], dx: []};
var d = [];

//STAR VARIABLES:
var numStars = 100;
var star = {x: [], y: [], s: [], dx: []};

//IMG VARIABLES:
var porthole;
var astroLinks = ["https://i.imgur.com/FrLKzou.png",
				  "https://i.imgur.com/vdhX4kE.png",
				  "https://i.imgur.com/01Kk3J7.png"];
var astroPics = [];
var astro = {x: [], y: [], s: [], dx: [], e: []};

function preload(){
	for(k = 0; k < 3; k++){
		astroPics[k] = loadImage(astroLinks[k]);
	}
	porthole = loadImage("https://i.imgur.com/YSSOdgW.png") //made this porthole graphic myself
}

function setup() {
    createCanvas(480, 480);
    background(0);
    planetInitialize();
    starInitialize();
    astroInitialize();
}

function draw() {
	background(0);
	starUpdate();
	planetUpdate();
	astroUpdate();
	image(porthole, 0, 0, width, height);
}

function drawPlanetA(x, y, s, i){ //option one for planet type (moon-y)
	strokeWeight(0);
	fill(planet.r[i], planet.g[i], planet.b[i]); //randomized color
	ellipse(x, y, s, s);
	fill(planet.r[i] + 20, planet.g[i] + 20, planet.b[i] + 20); //randomized color, but a little bit lighter
	ellipse(x - s/10, y + s/3, s/4);
	ellipse(x + s/5, y - s/10, s/3);
	ellipse(x - s/4, y - s/5, s/7);
}

function drawPlanetB(x, y, s, i){ //option two for planet type (saturn-y)
	fill(planet.r[i], planet.g[i], planet.b[i]);
	ellipse(x, y, s, s);
	strokeWeight(3);
	stroke(255-planet.r[i], 255-planet.g[i], 255-planet.b[i]);
	line(x - s*(2/3), y, x + s*(2/3), y);
	strokeWeight(0);
}

function starUpdate(){
	for(var j = 0; j < numStars; j++){
		strokeWeight(0)
		fill(250, 248, 235); //creamy white
		ellipse(star.x[j], star.y[j], star.s[j], star.s[j]);

		if(star.x[j] >= width + star.s[j]){ //if star has fully moved off screen, I reset the values
			star.s[j] = random(1, 10);
			star.x[j] = random(-20, 0-star.s[j]); //HOWEVER, I reset the values with the X position offscreen, so there appears to be a continuous scroll
			star.y[j] = random(0, height);
    	    star.dx[j] = star.s[j] / 200;
		}else{
			star.x[j] += star.dx[j]; //if star is not offscreen, it moves to the right
		}
	}
}

function planetUpdate(){
	for(var i = 0; i < numPlanets; i++){ 
		if(d[i] <= 1){ //selects planet type: if d is less than/equal to one, planet A is drawn, if d is greater than one, planet B is drawn
			drawPlanetA(planet.x[i], planet.y[i], planet.s[i], i);
		}else if(d[i] > 1){
			drawPlanetB(planet.x[i], planet.y[i], planet.s[i], i);
		}

		if(planet.x[i] >= width + planet.s[i] + (planet.s[i] * (2/3))){ //if planet has fully moved off screen, I reset the values
			planet.s[i] = random(10, 150);
			planet.x[i] = random(-200, 0-planet.s[i]); //HOWEVER, I reset the values with the X position offscreen, so there appears to be a continuous scroll
			planet.y[i] = random(0, height);
    	    planet.r[i] = random(20, 235);
    	    planet.g[i] = random(20, 235);
    	    planet.b[i] = random(20, 235);
    	    planet.dx[i] = planet.s[i] / 200;
		}else{
			planet.x[i] += planet.dx[i]; //if planet is not offscreen, it moves to the right
		}
	}
}

function astroUpdate(){
	for(var k = 0; k < 3; k++){
		image(astroPics[k], astro.x[k], astro.y[k], astro.s[k], astro.s[k]);
		if(astro.x[k] >= astro.e[k]){
			astro.x[k] = random(-2000, -150);
			astro.y[k] = random(0, height);
			astro.s[k] = random(30, 400);
			astro.dx[k] = astro.s[k] / 200;
			astro.e[k] = random(height+150, 2000);
		}else{
			astro.x[k] += astro.dx[k];
		}
	}
}

function planetInitialize(){
	for(var i = 0; i < numPlanets; i++){
    	planet.x[i] = random(0, width); //x position
    	planet.y[i] = random(0, height); //y position
    	planet.s[i] = random(10, 150); //size
    	planet.r[i] = random(20, 235); //r, g, and b are randomized. I seperated these instead of creating a color variable so I could use R, G, and B to edit the details
    	planet.g[i] = random(20, 235);
    	planet.b[i] = random(20, 235);
    	planet.dx[i] = planet.s[i] / 200; //dx is related to the size of the planet, if it's bigger it will appear to move quicker
    	d[i] = (random(0, 2)); //variable d selects whether or not planet type A or B is selected
    }
}

function starInitialize(){
	for(var j = 0; j < numStars; j++){
    	star.x[j] = random(0, width);
    	star.y[j] = random(0, height);
    	star.s[j] = random(1, 10);
    	star.dx[j] = star.s[j] / 200; //dx is related to the size of the star, if it's bigger it will appear to move quicker
    }
}

function astroInitialize(){
	for(var k = 0; k < 3; k++){
    	astro.x[k] = random(-2000, width)
    	astro.y[k] = random(0, height);
    	astro.s[k] = random(30, 150);
    	astro.dx[k] = astro.s[k] / 200; 
    	astro.e[k] = random(height+150, 2000); //astro end: beginning/end determines where image starts/ends it's journey before reset. I made the value larger so there would be greater diversity in when astronaunts appeared
    }
}
]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/17/project-11/feed/ 0
Looking Outwards-11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/16/looking-outwards-11/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/16/looking-outwards-11/#respond Wed, 16 Nov 2022 05:39:03 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75743 Continue reading "Looking Outwards-11"]]>

The article I selected is “Finding Inspiration for Art in the Betrayal of Privacy” by Jenna Wortham in the New York Times. The article focuses on an exhibition in a gallery in Lower Manhattan put on by a Berlin group called the Tactical Technology Collective. The exhibition looked at the impact of technology and how it observes us on the daily through an artistic lens. One example that they used which I found interesting was how step and activity data may be used in the future to determine insurance costs. This would cause people to “hack” their devices in order to make it seem like they moved more in order to lower their insurance costs. They also experimented with a facial-recognition software called “Churchix” to create an immersive experiment for gallery goers. The way the Tactical Technology Collective subverted technology that we use day to day lives, causes us to rethink our own relationship with technology and the way we “buy into” our own surveillance on the daily.

]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/16/looking-outwards-11/feed/ 0
LO 11 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/15/lo-11/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/15/lo-11/#respond Tue, 15 Nov 2022 17:53:55 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75734 Continue reading "LO 11"]]>

Hannah Wyatt section A

When an AI face-recognition program fails only to detect colored women, there is clearly a systemic issue. ARS Electronica Blog dissects this bias in the article “Women in Media Arts”, attributing fault with the creators themselves: White Men. In Joy Buolamwini (US) and Timnit Gebru (ETH)’s project “Gender Shades”, they researched discrimination regarding gender and skin colour of people, finding the cause to be incomplete data sets.

The article encourages readers to reflect on the societal consequences-if these people are misrepresented, they may earn less opportunities in select technological fields. Thus, Caroline Sinders (US) devised ‘feminist data sets’ in order to counteract bias in machine-learning, surrounding art, interviews, and data collection by women. Mary Flanagan’s study “Help Me Know The Truth”  measures the larger impact/structural flaws in society through assessing participant’s views of random subjects as either ‘victims’ or ‘criminals’.

]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/15/lo-11/feed/ 0
Srishty’s Project 10 https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/srishtys-project-10/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/srishtys-project-10/#respond Sun, 13 Nov 2022 02:08:48 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75609 Continue reading "Srishty’s Project 10"]]>

I made a simple story about a girl (me) who goes on a walk to the park. During her time there as she walks by, she sees tom and jerry start chasing each other all over the park and she starts laughing. The background d elements and all elements other than tom and jerry were done on illustrator and imported to imgur. My 4 characters are the cloud making the wind sound, the tom making the meow sound, the girl laughing, and the bird chirping.

sketch

// SRISHTY BHAVSAR
//SECTION C
//PROJECT 10
/*
I made a simple story about a girl (me) who goes on a walk to the park. During her time there as she walks by, 
she sees tom and jerry start chasing each other all over the park and
she starts laughing. The background d elements and all elements other than tom and jerry were done on illustrator
and imported to imgur. My 4 characters are the cloud making the wind sound, the tom making the meow sound, the girl 
laughing, and the bird chirping.
*/



// call global variables

//background image
var bgPhoto

//CHARACTERS
// cloud
    var cloudX = 0;

    // bird
    var birdImage = [];
    var birdX = 500;
    var birditem = 0;
    var birdwidth = 80

    // srishty (me)
    var srishtyImage;
    var srishtyx =500;

    // cloud
    var cloudImage;
    var cloudx = 300

    // tom and jerry
    var tomandjerry = [];
    var tomandjerryx = 70;
    var tomandjerryitem = 0;
    var tjdy = 1
    var tjdx = 1

// frame counter initializer
var count = 0; 




//load images to imgur
function preload() {
    bgPhoto = loadImage("https://i.imgur.com/75aDbMe.png");
    // images
    birdImage[0] = loadImage("https://i.imgur.com/o1P0pBO.png"); // first image in the bird list
    birdImage[1] = loadImage("https://i.imgur.com/48woLcm.png"); // first image in the bird list
    srishtyImage = loadImage("https://i.imgur.com/b5N2LzO.png"); // srishty image
    cloudImage = loadImage("https://i.imgur.com/xG8RjYF.png"); // cloud image
    tomandjerry[0] =loadImage("https://i.imgur.com/8nNCYkE.png");
    tomandjerry[1] =loadImage("https://i.imgur.com/cDSNU65.png");
    tomandjerry[2] =loadImage("https://i.imgur.com/LcYpbag.png");
    tomandjerry[3] =loadImage("https://i.imgur.com/wYhvMJo.png"); 

    //sounds
    wind = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/wind.wav");
    meow = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/meow.wav");
    laugh = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/laugh.wav");    
    chirp = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/chirp.wav");  
}


function soundSetup(){
    wind.setVolume(.1);
    meow.setVolume(2);
    chirp.setVolume(.1);
    laugh.setVolume(2);
}

function setup() {
    createCanvas(400, 400);
    //frameRate(5);
    imageMode(CENTER);
    useSound();

}

function draw() {
    count++; // add one frame to draw function
    //background image
    image(bgPhoto, width/2, height/2, width, height);



    wind.play();
    chirp.play();



    //call characters
    drawCloud();
    drawbird();
    drawTandJ()
    drawSrishty();
  
    if (count == 450 || count == 750) {
        meow.play();
    }
    if (count == 500 || count ==800) {
        laugh.play();
    }
}

// function for bird flapping

function drawbird() {

    image(birdImage[birditem], birdX, 104, birdwidth,30); 
    // if the frame counter is odd have the bird's item be the first one, if even have it be the second one 
    //fkapping affect 
    if (count % 2 === 0 ) { // bird frame 1
        birditem = 1;
        birdwidth = 100
        birdX -= .5; // bird flies to left
    }
    if (count % 2 === 1 ) {    // bird frame 0
        birditem = 0;
        birdwidth = 80;
        birdX -= .5; // bird flies to left
    }

}

function drawSrishty() {
    var heightcount = .5
    if (count >= 30) { // srishty walks in 30 frames after bird

        // staggering heights so it looks like walking rather than glide
        if (count % 2 === 0 ) { //odd
            image(srishtyImage, srishtyx - heightcount, 325, 66.2218, 205.4745); 
            srishtyx -= .3; // srishty walks to left

        }
        if (count % 2 === 1 ) { //even
            image(srishtyImage, srishtyx, 325 + heightcount, 66.2218, 205.4745); 
            srishtyx -= .3; // srishty walks to left

        }
    }

}

function drawCloud() { // draw cloud
    image(cloudImage, cloudx, 69, 130.2123 , 46.6313 );
    cloudx -= 0.09; //cloud moves very slowly
}

function drawTandJ() { // tom and jerry frames chasing eachother

        if (count >= 0 & count <= 400 ) { 
            image(tomandjerry[tomandjerryitem], tomandjerryx, 300, 216.9349, 162.7012);
            tomandjerryitem = 0
        }

        if (count >= 400 & count <= 500) { 
            image(tomandjerry[tomandjerryitem], (tomandjerryx + 100) + tjdx, 300, 216.9349, 162.7012);
            tomandjerryitem = 1
            tjdx += .5
        }

        if (count >= 500 & count <= 750) {
            image(tomandjerry[tomandjerryitem], (tomandjerryx + 300) -tjdx, 400 - tjdy, 220, 120.7012);
            tomandjerryitem = 2
            tjdy += .5;
            tjdx += .5
        }
        if (count >= 750 & count <= 2000 ) { 
            image(tomandjerry[tomandjerryitem], (tomandjerryx + 200)-tjdx, 400 - tjdy, 216.9349/2, 162.7012/2); 
            tomandjerryitem = 3
            tjdy += .5;
            tjdx += 2;

        }

}
 


]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/srishtys-project-10/feed/ 0
Project 10: Sonic Story https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/project-10-sonic-story/ https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/project-10-sonic-story/#respond Sat, 12 Nov 2022 18:54:26 +0000 https://courses.ideate.cmu.edu/15-104/f2022/?p=75513 Continue reading "Project 10: Sonic Story"]]>

One Night on the Farm
One night on the farm, the farmer left the animals out. The crickets were chirping and the chickens were clucking. A whirring hum was heard and an alien space ship appeared. The alien first abducted the sheep who let out a surprised “baa” as he rose into the air and shrunk. The pig was next. He let out a startled “oink” as he was lifted away from his mud. Then it was the cows turn. He let out a shocked “moo” before being whisked away. The space ship left with its new specimens, and the crickets chirped and the chickens clucked some more.

The farm images are licensed from Adobe stock images. The sounds used are from freesound.org and edited with Audacity. The sounds are used under the Creative Commons license. The owners did not want attribution. The sounds are: crickets.wav – crickets chirping, cluckcluck.wav – chickens clucking, spaceShip.wav – space ship sounds, moo.wav – a cow, baa.wav – a sheep, oink.wav – a pig.

sketch
/* Evan Stuhlfire
 * estuhlfi@andrew.cmu.edu Section B
 * Project-10:  Sonic Story - One Night on the Farm 
Assignment-10:  Sonic Story 
One Night on the Farm 
One night on the farm, the farmer left the animals 
out. The crickets were chirping and the chickens were
clucking. A whiring hum was heard and an alien space ship appeared.
The alien first abducted the sheep who let out a surprised "baa" as he
rose into the air and shrunk. The pig was next. He let out a startled
"oink" as he was lifted away from his mud. Then it was the cows turn. 
He let out a shocked "moo" before being whisked away. The 
space ship left with its new specimens, and the crickets chirped
and the chickens clucked some more.

The farm images are liscensed from Adobe stock images. The sounds used are from freesound.org and edited with Audacity.
The sounds are used under the Creative Commons liscense. The owners did not 
want attribution. The sounds are:
crickets.wav - crickets chirping, cluckcluck.wav - chickens clucking,
spaceShip.wav - space ship sounds, moo.wav - a cow, baa.wav - a sheep,
oink.wav - a pig.
 */

var farmImg = [];   // an array to store the images
var farmObjArray = []; // array to store images

// sound variables
var crickets;
var cluck;
var baa;
var moo;
var oink;
var spaceShip;

// starting sky and foreground colors
var rNight = 50;
var gNight = 100;
var bNight = 150;
var rFore = 50;
var gFore = 160;
var bFore = 80;
var moon = 100;
// position of the moon
var xMoon;
var yMoon;

// map to array indexes
var fence = 0;
var barn = 1;
var hay = 2;
var cow = 3;
var pig = 4;
var sheep = 5;
var chicken = 6; 
var rooster = 7;
var ship = 8;

function preload(){
    // These URLs are images stored on imgur 
    // images liscensed from Adobe Stock images
    // preload farm images
    var filenames = [];
    filenames[fence] = "https://i.imgur.com/bbBOrZ7.png"; 
    filenames[barn] = "https://i.imgur.com/inS5Xdt.png"; 
    filenames[hay] = "https://i.imgur.com/IXPEVak.png"; 
    filenames[cow] = "https://i.imgur.com/8XjQyMt.png"; 
    filenames[pig] = "https://i.imgur.com/7VPvVRB.png"; 
    filenames[sheep] = "https://i.imgur.com/vIFlqDY.png"; 
    filenames[chicken] = "https://i.imgur.com/vdTxUKf.png"; 
    filenames[rooster] = "https://i.imgur.com/SCYoQoX.png"; 
    filenames[ship] = "https://i.imgur.com/lAHddxj.png"
    // load farm images
    for (var i = 0; i < filenames.length; i++) {
        farmImg[i] = loadImage(filenames[i]);
    }

    // load sounds
    crickets = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/crickets2.wav");
    cluck = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/cluckcluck.wav");
    baa = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/baa.wav");
    moo = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/moo.wav");
    oink = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/oink.wav");
    spaceShip = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/spaceShip.wav");

}

function stepImage() {
    // // move and grow the space ship to get the sheep
    if(this.imageNum == ship & this.moving) {
        if(this.target == sheep) {
            if(this.x < width/4) {
                this.x += this.speed;
            }
            if(this.y < height/2.5) {
                this.y += this.speed;
            }
            if(this.ySize <= 100) {
                this.ySize += this.speed;
            }
            if(this.xSize <= 200) {
                this.xSize += this.speed;
            } else {
                if(this.drawBeam) {
                    drawBeam(this.x, this.y, this.target); 
                }
            }
        } else if(this.target == pig) {
            // move the space ship to get the pig
            this.drawBeam = true; // turn the beam back on

            if(this.ySize >= 80) {
                this.ySize -= this.speed;
            }
            if(this.xSize >= 180) {
                this.xSize -= this.speed;
            }

            if(this.y > height/3) {
                this.y -= this.speed;
            }
            if(this.x <= width/2) {
                this.x += this.speed;
            } else {
                if(this.drawBeam) {
                    drawBeam(this.x, this.y, this.target); 
                }
            }
        } else if(this.target == cow) {
            // move the space ship to get the cow
            this.drawBeam = true; // turn the beam back on

            if(this.ySize <= 120) {
                this.ySize += this.speed;
            }
            if(this.xSize <= 240) {
                this.xSize += this.speed;
            }

            if(this.y < height/1.8) {
                this.y += this.speed;
            }
            if(this.x >= width/4) {
                this.x -= this.speed;
            } else {
                // the ship is in the correct location for the beam
                if(this.drawBeam) {
                    drawBeam(this.x, this.y, this.target); 
                }
            }
        } else if(this.target < cow) {
            // fly away
            if(this.ySize >= 0) {
                this.ySize -= this.speed;
            }
            if(this.xSize >= 0) {
                this.xSize -= this.speed;
            }
            if(this.y > 0) {
                this.y -= this.speed;
            }
            if(this.x <= width) {
                this.x += this.speed;
            }
        }
    } 

    // when an animal is being abducted it shrinks and rises into the ship
    if(this.imageNum == farmObjArray[ship].target & this.moving) {
        // decrease y to rise into the ship
        if(this.y >= farmObjArray[ship].y) {
            this.y -= this.speed;
        } else {
            // turn the beam off and set target to pig
            farmObjArray[ship].drawBeam = false;

            // don't decrease the target below the cow index
            if(farmObjArray[ship].target >= cow) {
                farmObjArray[ship].target--;
            }
            
            // stop drawing this image
            this.moving = false;
            this.drawOn = false;
        }
        
        // shrink
        if(this.xSize > 0) {
            this.xSize *= .95;
        }
        if (this.ySize > 0) {
            this.ySize *= .95;
        } 
        if(this.imageNum == sheep & frameCount % 15 == 0) {
            baa.play();
        } else if(this.imageNum == pig & frameCount % 15 == 0) {
            oink.play();
        } else if(this.imageNum == cow & frameCount % 12 == 0) {
            moo.play();
        }

    }
}

function drawImage() {
    // draw image
    if(this.drawOn){
       image(farmImg[this.imageNum], this.x, this.y, this.xSize, this.ySize);
    } 
}

// Constructor for each farm image
function makeObj(cx, cy, imNum, xs, ys) {
    var c = {x: cx, y: cy, xSize: xs, ySize: ys, 
             imageNum: imNum,
             moving: false,
             drawBeam: true,
             target: sheep,
             speed: 5,
             drawOn: true,
             stepFunction: stepImage,
             drawFunction: drawImage
         }
    return c;
}

function setup() {
    createCanvas(480, 480);
    // set farm colors
    background(rNight, gNight, bNight);
    foreground(rFore, gFore, bFore);
    // set initial moon position
    xMoon = width + 25;
    yMoon = height/2.25;
    xShip = width/4;
    yShip = height/2 + 50;

    imageMode(CENTER);
    // create array of farm objects
    createFarmObjs(); 

    frameRate(10);
    useSound();
}

function soundSetup() { // setup for audio generation
    crickets.setVolume(0.1);
    cluck.setVolume(0.3);
    baa.setVolume(0.3);
    moo.setVolume(0.5);
    oink.setVolume(0.3);
    spaceShip.setVolume(0.5);
}

function draw() {
    noStroke();
    background(rNight, gNight, bNight);
    foreground(rFore, gFore, bFore);
    makeSounds();

    var currentImage;
    // loop over farm images and draw them
    for(var i = 0; i < farmObjArray.length; i++) {
        currentImage = farmObjArray[i];
        // draw the farm
        currentImage.stepFunction();
        currentImage.drawFunction();
    }

    // darken to night sky
    fadeNightSky();        

}

function makeSounds() {
    // make sounds at frameCount intervals
    // play crickets
    if(frameCount >5 & frameCount < 350 && frameCount % 25 == 0) {
        crickets.play();
    } 
    // play cluck cluck
    if ((frameCount > 24 & frameCount < 350 && frameCount % 50 == 0)) {
        cluck.play();
    }
    if(frameCount > 24 & frameCount < 200 && frameCount % 25 == 0) {
        spaceShip.play();
    }

    if(frameCount > 400){
        // stop all sounds
        crickets.stop();
        cluck.stop();
        spaceShip.stop();
        baa.stop();
        moo.stop();
        oink.stop();

        // stop looping
        noLoop();
    }
}

function createFarmObjs() {
    // create objects for farm: fence, barn, hay
    // set initial positions xPos and yPos
    var xPos = width/1.25;
    var yPos = height/2;

    // set initial size
    var xs = 125;
    var ys = 125;

    // create farm objects
    farmObjArray[fence] = makeObj(width/2, yPos + 20, fence, xs * 5, 
        ys * .25);
    farmObjArray[barn] = makeObj(xPos, yPos, barn, xs, ys);
    farmObjArray[hay] = makeObj(xPos + 50, yPos + 50, hay, xs/2, ys/2);
    farmObjArray[cow] = makeObj(width/4, height/1.2, cow, 100, 70);
    farmObjArray[pig] = makeObj(width/2, height/1.68, pig, 55, 45);
    farmObjArray[sheep] = makeObj(width/4, height/1.65, sheep, 30, 50);
    farmObjArray[chicken] = makeObj(width/1.2, height/1.35, 
        chicken, 25, 35);
    farmObjArray[rooster] = makeObj(width/1.3, height/1.45, 
        rooster, 30, 40);
    farmObjArray[ship] = makeObj(0, height/8, ship, 20, 1);
}

function drawBeam(x, y, target) {
    // draw beam
    fill(240, 250, 240, 80);
    triangle(x, y, x + 65,
        farmObjArray[target].y + 40, 
        x - 65,
        farmObjArray[target].y + 40);

    // set target to moving
    farmObjArray[target].moving = true;
}

function fadeNightSky() {
    // decrease the background colors to darken the sky to night
    var offset = 5;
    rNight -= offset;
    gNight -= offset;
    bNight -= offset;
    rNight = max(0, rNight);
    gNight = max(0, gNight);
    bNight = max(0, bNight);

    // draw moon
    if(rNight == 0) {
        fill(moon);
        ellipse(xMoon, yMoon, 50);
        moon++;
        moon = min(moon, 245);  
        xMoon -= offset;
        yMoon -= offset;
        xMoon = max(width/1.35, xMoon);
        yMoon = max(height/7.75, yMoon);
    }

    // when it is dark start moving space ship
    if(bNight == 0) {
          farmObjArray[ship].moving = true;
    }
}

function foreground(r, g, b) {
    // create lawn and mud puddle for pig
    fill(r, g, b);
    rect(0, height/2, width, height/2);

    fill(90, 80, 15);
    ellipse(width/2 - 10, height/1.6, 150, 25);
}
]]>
https://courses.ideate.cmu.edu/15-104/f2022/2022/11/12/project-10-sonic-story/feed/ 0