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;

        }

}
 


Project 10

Under the sea! My 5 characters are the ocean, jellyfish, fish, big whale, and small whale.

sketch
// Sowang Kundeling Project 10 Section C

var count = 0;
x = 50
var count = 0

function preload() {
  ocean = loadSound("http://localhost:8887/ocean.wav");
  low = loadSound("http://localhost:8887/low.wav");
  bubble = loadSound("http://localhost:8887/bubble.wav");
  high = loadSound("http://localhost:8887/high.wav");
  splash = loadSound("http://localhost:8887/splash.wav");

  sea = loadImage("https://i.imgur.com/cDVwxGl.jpg");
  big = loadImage("https://i.imgur.com/3j8OG8S.png");
  little = loadImage("https://i.imgur.com/eBmN7hL.png");
  jellyfish = loadImage("https://i.imgur.com/LbEcOSU.png");
  fish = loadImage("https://i.imgur.com/FSQzu31.png")
}

function soundSetup() {
  ocean.setVolume(.1);
  low.setVolume(.3);
  bubble.setVolume(.1);
  high.setVolume(.3);
  splash.setVolume(.1);
}

function setup() {
  createCanvas(sea.width, sea.height);
  frameRate(1);
  useSound();
}

function draw() {
  image(sea, 0, 0, sea.width, sea.height);
  ocean.play();

  if(count == 2 || count == 16) {
    low.play();
  } else if(count == 4 || count == 18) {
    bubble.play();
  } else if (count == 10 || count == 25) {
    high.play();
  } else if (count == 1 || count == 30 || count == 15) {
    splash.play();
  }

  if(count >= 5) {
    image(big, 20, 50, big.width/4, big.height/4);
  } if(count >= 10) {
    image(little, 400, 200, little.width/2, little.height/2);
  } if(count >= 4) {
    image(jellyfish, x, 300, jellyfish.width/4, jellyfish.height/4);
  } if (count >= 15) {
    image(fish, mouseX, mouseY, fish.width/6, fish.height/6);
  }

  count++
  x += 2

  print(count);
}

Project 10 – SANIC

Sanic make “dash” noises every now and then

Eggman has “intro” and “escape” lines

Rings make sounds when grabbed by sanic

Knuckle makes sounds in the end

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

//rotation variables for limb movements for sanic and the coins
var rot = 0;
//controls whether the limbs are moving forwards or backwards
var forward = true;
//sanic locations
var x=0;
//eggman image
var egg;
//eggman Ylocation
var eggY = -150;
//uganda knuckle's Ylocation
var ugandaY = 450;

//Green Hill Zone notes (BACKGROUND MUSIC)
var pitch = [72,69,72,71,72,71,67, 0, 69,76,74,72,71,72,71,67, 0, 72,69,72,71,72,71,67, 0, 69,69,65,69,67,69,67,60, 0];
var duration = [3,9,3,9,3,9,12, 15, 3,3,9,3,9,3,9,12, 15, 3,9,3,9,3,9,12, 15, 3,3,9,3,9,3,9,12, 15];

//counter for durations
var counter = 0;
//which note on the pitch list to play
var note = 0;

//rings' existance
var coin = [true,true,true,true,true];

//sound variables
var eggmanIntro;
var ringSound;
var dawae;
var spinDash;
var eggmanDefeat

//https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/name-eggman.wav
//https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/Sonic_Ring_Sound_Effect.wav
//https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/do-you-know-the-way.wav
//https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/Spin.wav
//https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/no.wav


//loading the images and sounds
function preload() {
    egg = loadImage("https://i.imgur.com/Wy46mQF.png");
    uganda = loadImage ("https://i.imgur.com/HRB5kdy.png");
    eggmanIntro = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/name-eggman.wav");
    ringSound = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/Sonic_Ring_Sound_Effect.wav");
    dawae = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/do-you-know-the-way.wav");
    spinDash = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/Spin.wav");
    eggmanDefeat = loadSound ('https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/no.wav');
}

//setups Don't think I need to elaborate
function setup() {
    createCanvas(600,300);
    useSound();
    frameRate(20);
}

function soundSetup() { 
    osc = new p5.Oscillator();
    osc.amp(0.25);
    eggmanIntro.setVolume(1.0);
    ringSound.setVolume(0.5);
    dawae.setVolume(0.5);
    spinDash.setVolume(0.5);
    eggmanDefeat.setVolume(1.0);
    osc.setType('square');
    osc.start();
}



function draw() {

    background(255);
    //rotation till 1 then change directions
    if (rot>=1 || rot <=-1)
    {
        forward = !forward;
    }
    if (forward)
    {
        rot+=0.1;
    }
    else
    {
        rot-=0.1;
    }

    //move sanic by 1 per frame
    x+=1;

    //check whether sanic ran pass through those rings or not
    for (var k=0; k<5; k++)
    {
        if (x>(100+k*100))
        {
            coin[k] = false;
        }
    }

    //if sanic is on the ring play ring sound
    if (x%100==0 & x<600 && x>0)
    {
        ringSound.play();
    }

    //sanic spins every now and then if he's on the screen
    if (x%100==50 & x<=600 && x>=0)
    {
        spinDash.play();
    }

    //rings
    ring(100,170,rot,coin[0]);
    ring(200,170,rot,coin[1]);
    ring(300,170,rot,coin[2]);
    ring(400,170,rot,coin[3]);
    ring(500,170,rot,coin[4]);

    //eggman shows up
    if (eggY<50)
    {eggY+=2;}

    //eggman "escapes"
    if (x>300 & eggY<1000)
    {
        eggY = 50 + (x-300) * (x-300);
    }

    //eggman intro right before he stops
    if (eggY==48)
    {
        eggmanIntro.play();
    }

    //eggman says no moment after he's defeated
    if (eggY==54)
    {
        eggmanDefeat.play();
    }
    //eggman image
    eggman(300,eggY);

    //sanic
    sanicLimbs(x,100,rot);
    sanic(x,100);

    //uganda knuckle shows up
    if (x>700 & ugandaY > 200)
    {
        ugandaY -=2;
    }

    //"DO YOU KNOW DA WAE" before stoping
    if (ugandaY==202)
    {
        dawae.play();
    }

    //kunckle
    knuckle(300,ugandaY);


    //if pitch is 0 stop playing
    if (pitch[note] == 0)
    {
        osc.stop();
    }

    //if pitch before is 0 but this note isn't restart
    else if (pitch[note-1] == 0 & pitch[note] != 0)
    {
        osc.start();
    }

    //play notes
    osc.freq(midiToFreq(pitch[note]));

    //duration counter ++
    if (counter < duration[note] & note < pitch.length)
    {
        counter++
    }
    //if reach max duration change note and reset
    else if (counter >= duration[note] && note < pitch.length)
    {   
        counter = 0;
        note++;
    }
    //if reach the end restart from the beginning to loop
    else
    {
        note=0;
    }

}

//drawing sanic
function sanic(xL,yL)
{   
    push();
    translate(xL,yL);
    noStroke();
    stroke(0);
    fill("blue");
    curve(-10,100,-7,-10,-50,-30,-50,50);
    curve(-10,100,-7,10,-50,10,-50,50);
    curve(-10,100,-7,30,-65,20,-50,100);
    curve(-10,100,-7,40,-50,30,-50,50);
    curve(-10,100,-7,90,-75,70,-50,200);
    strokeWeight(1);
    ellipse(0,25,10,20);
    ellipse(0,0,50,45);
    ellipse(0,70,70,75);
    fill(255,255,170);
    ellipse(0,70,40,45);
    ellipse(3,15,25,10);
    fill(255);
    ellipse(10,0,15,13);
    ellipse(-8,0,15,10);
    fill(0);
    ellipse(12,0,3,3);
    ellipse(-6,0,3,3);
    ellipse(0,8,4,4);
    stroke(5);
    curve(-7,5,-7,15,16,15,16,5);
    pop();
}

//drawing sanic's llimbs 
function sanicLimbs (xL,yL,r)
{
    push();
    translate(xL,yL);

        push();
        translate(15,50);
        rotate(r);
        fill("blue");

        beginShape();
        vertex(0, 0);
        bezierVertex(0,0,30,-50,60,0);
        bezierVertex(60,0,30,-25,0,0);
        endShape();

        fill(255);
        ellipse(60,0,20,20);
        pop();


        push();
        translate(-15,60);
        rotate(r);
        fill("blue");

        beginShape();
        vertex(0, 0);
        bezierVertex(0,0,-30,-55,-60,0);
        bezierVertex(-60,0,-30,-15,0,0);
        endShape();

        fill(255);
        ellipse(-60,0,30,25);
        pop();

        push();
        translate(0,100);
        rotate(r);
        fill("blue");

        beginShape();
        vertex(0, 0);
        bezierVertex(0,0,-60,0,-60,60);
        bezierVertex(-60,60,-60,40,0,0);
        endShape();

        fill("red");
        ellipse(-70,60,40,20);
        pop();

        push();
        translate(20,100);
        rotate(r);
        fill("blue");

        beginShape();
        vertex(0, 0);
        bezierVertex(0,0,0,40,60,60);
        bezierVertex(60,60,0,80,0,0);
        endShape();

        fill("red");
        ellipse(70,60,40,20);
        pop();


    pop();
}

//ring spins through scalling
function ring (xR,yR,sc,sh)
{
    if (sh==true)
    {
    push();
    translate(xR,yR);
    scale(sc,1.0);
    fill("gold");
    ellipse(0,0,50,50);
    fill(255);
    ellipse(0,0,30,30);
    pop();
    }

}

function eggman (xE,yE)
{
    image(egg,xE,yE,150,150);
}

function knuckle (xU, yU)
{
    push();
    imageMode(CENTER);
    image(uganda,xU, yU, 250,250);
    pop();
}

LO9:A Focus on Women and Non-binary Practitioners in Computational Art

In this week’s Looking Outward, I picked Eva Schindling’s work called Liquid Sound Collision.

In this work project, Eva shows a simulation of sound wave’s collision with the property of water waves. She initials the simulation with a cylinder, and the on the two ends of the cylinder, she started to implement sound on the surface. These sound waves expands like actual waves, and as they collide in the middle, the whole shape of the cyliner start to twist and change. There are a lot of uncertainty in the shape of the cylinder, as the sound waves have various shapes. Eva refers these shapes as a tension resulted from confrontations of body and mind, chaos and order, and simplicity and complexity. She uses this simulation into sculptures and other art works.

I think this is a very useful and meaningful exploration in visualizing abstract ideas. We usually talk about conflict, confrontation, and tension between relationships, but it’s very hard to actually see these ideas. But this simulation makes people feel these confrontations.

Eva is a female artist that explores technology, computation, and design. She visualizes a lot of abstract ideas such as higher dimensions into something that we can feel and understand.

http://www.evsc.net/home/liquid-sound-collision

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);
}

Looking Outwards-09

One project I found when looking at all the amazing female computer artists was called “Another Moon” by Mimi Son. This was in development since 2015 as an outdoor art exhibition with lasers, code, solar panels, and other elements. It creates “a technically sublime second moon in the sky.” It was made using scanning mirror laser projectors, which were protected from weather during the day as it gained energy from the solar panels to be released through the laser into the sky again at night. I admire this work because it’s very energy efficient while also spectacularly beautiful to behold – I think the use of the lasers is innovative and breathtaking, and I appreciate the thought and care that went into it. The artist, Mimi Son, is the founder of the Seoul-based art studio called Kimchi and Chips, which this exhibition was also a part of. She has a special interest in geometry and Buddhist philosophy, which allows her to use space and time to form various perspectives. Her area of expertise is Conceptualization & Interaction Design, which she studied at the Landsdown Center of Middlesex University in London. She’s also been a teacher of Interactive Storytelling in Korea for six years.

Watch “Another Moon” here.

Read about “Another Moon” here.

Space battle

The spaceship engages in fights with enemies by using energy machine guns and lasers. The most challenging part actually comes in making all the visuals work correctly.

Four characters/sounds:

  • Firing spaceship
  • Explosion
  • Charge laser
  • Shoot laser

Space battle

//Jason Jiang
//Section E

///Storyline: The spaceship engages fights with enemies through using energy machine gun and laser.

//setting up variables for stars
var star = [];
var N = 10; //number of starts
var dx = 10; //speed of star
var w = 600; //x location of enemy
var dShip = 10; //speed of enemy
var a = 0;//scale of laser beam
var imgX = 120;//x location of ship
var imgY = 100;//y location of ship
var angle = 0;//angle of ship
var laserCharged = false; //whether laser is charged
var laserFired = false; //whether laser is fired
var enemyDestroyed = false; //whether enemy is destroyed


//defining assets
var machineGun;
var explosion1;
var explosion2;
var explosion3;
var laserEnergy;
var laserBeam;
var flyEngine;
var machineGun;
var explosion;
var charge;
var laser;

//add assets
function preload(){
    spaceShip = loadImage("https://i.imgur.com/D1QDG4A.png");
    spaceShipFire = loadImage("https://i.imgur.com/h8bQMXa.png");
    enemy1 = loadImage("https://i.imgur.com/OE8l2tK.png");
    explosion1 = loadImage("https://i.imgur.com/c9tLLTo.png");
    explosion2 = loadImage("https://i.imgur.com/kLTBXIa.png");
    explosion3 = loadImage("https://i.imgur.com/0zhmrzn.png");
    laserEnergy = loadImage("https://i.imgur.com/bmn9wZX.png");
    laserBeam = loadImage("https://i.imgur.com/ABposfH.png");
    machineGun = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/machineGun.mp3");
    explosion = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/explosion.wav");
    charge = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/charge.wav")
    laser = loadSound("https://courses.ideate.cmu.edu/15-104/f2022/wp-content/uploads/2022/11/laser.wav")
}

// setup for audio generation
function soundSetup() { 
    machineGun.setVolume(0.1);
    explosion.setVolume(0.1);
    charge.setVolume(0.2);
    laser.setVolume(0.1);
}

//Create galaxy background
function updateStar(){
    this.x -= dx;
}

function createStar(){
    strokeWeight(3);
    stroke(255);
    point(this.x, this.y);
}

function generateStar(sx, sy){
   for (var i=0; i<N; i++){
        var s = {
            x: sx, y: sy,
            stepFunction: updateStar,
            drawFunction: createStar
        }

    }
    return s;
} 

function setup() {
    createCanvas(400, 200);
    frameRate(10);
    imageMode(CENTER);
    for (var i=0; i<N; i++){
        var s = generateStar(random(width), random(height))
        star.push(s);
 }
     useSound();
}


function draw() {
    background(0);
    //setting up sequence for charging laser and firing laser
    if (a >= 1){
            if(laserCharged == false){
                laserCharged = true
                a = 0
                charge.stop()
                laser.play();
            }
            else if(laserCharged == true & laserFired == false){
                laserFired = true
                a = 0
                laser.pause();
            }
        }
    //resetting enemy position if destroyed  
    if (enemyDestroyed == true){
            w = 600;
        }

   //Update star
    for (var i=0; i<N; i++){
        var s = star[i]
        s.stepFunction();
        s.drawFunction();
        //Remove star that is out of bounds
        if (s.x < 0) {
            var s = generateStar(random(width+5, width+500), random(height))
            star.splice(i, 1, s);
        }
   
    }
    
    //flying spaceship
    if (frameCount >= 0 & frameCount < 30) { 
        flyinSpace(imgX, imgY, 0); 
    }
    
    //killing enemy
    if (frameCount >= 30 & frameCount < 60) { 
        
        //play ship firing sound
        if (w == 600){
            machineGun.loop();  
        }
        
            //ship firing
            shipFiring(w);
            //enemy Ship approaching
            enemyShip(w, height/2);
            w -= dShip; 
       
    
        }
    
    if (frameCount >= 60 & frameCount < 70) { 
        //stop firing
        flyinSpace(imgX, imgY, 0);
        //play explosion sound when the enemy is close
        if(frameCount == 60){
            machineGun.stop();
            explosion.play()
        }
            explode(w, height/2, 60);
        }
    
    if (frameCount >= 70 & frameCount < 110) { 
        //setting up next enemy
        enemyDestroyed = false;
        if(frameCount == 70){
            charge.loop();
        }

        //dodge laser 
        if(dist(imgX, imgY, 120, 160)>0 & laserCharged == true){
        flyinSpace(imgX, imgY, 0);
        imgY += dShip;  
        }
        else{
            flyinSpace(imgX, imgY, 0);
        }

        //enemy Ship
            enemyShip(w, height/2);
            w -= 0.5*dShip;
        
        //charge laser
        if (laserCharged == false){
            laserCharge(w, height/2, a);
            a+=0.05;
        }
        //fire laser
        else if(laserCharged == true & laserFired == false){
            
            laserCharge(w, height/2, 1);
            laserFire(w, height/2, -a);
            a+=0.05;
        }
    
   
}
        
        if (frameCount >= 110 & frameCount < 140) {
            //preparing for next shot
            if (frameCount == 110){
              laserCharged = false;
              laserFired = false; 
              charge.loop();
            }

            //enemy Ship
            enemyShip(w, height/2);
            w -= 0.5*dShip;
            
            //ship fire laser
            //rotate ship
            if (angle>=-18){
                flyinSpace(imgX, imgY, angle);
                angle-=3;
            }
            //fire laser after rotation
            else{
                //charge laser
                flyinSpace(imgX, imgY, angle)
                if (laserCharged == false){
                    laserCharge(imgX, imgY, a);
                    a+=0.1;
                }
                //fire laser
                else if(laserCharged == true & laserFired == false){
                    
                    laserCharge(imgX, imgY, 1);
                    laserFire(imgX, imgY, a, angle);
                a+=0.1;
            }
             
        }
    }
        
        if (frameCount >= 140 & frameCount < 150) { 
        flyinSpace(imgX, imgY, angle);
        //play explosion sound when the enemy is close
            if(frameCount == 140){
                explosion.play();
            }
            explode(w, height/2, 140);
        }

        if (frameCount >= 150){
            background(0);
            noLoop();
        }
}

//adding spaceship
function flyinSpace(x, y, a){
        push()
        translate(x, y);
        rotate(radians(a));
        image(spaceShip, 0, 0);
        pop()
        
}

function shipFiring(w){
        //ship firing
        if(w%20 == 0){
            image(spaceShipFire, 120, height/2);
        }
        else{
            image(spaceShip, 120, height/2);
        }
    }

function enemyShip(w, h){ 
        //enemy ship flying
            image(enemy1, w, h);
        }

function explode(w, h, f){
        //create explosion when the enemy is close
                image(explosion1, w, h);
                if(frameCount-f >= 3){
                    image(explosion2, w, h);
                }
                if(frameCount-f >= 6){
                    image(explosion3, w, h);
                    enemyDestroyed = true;
                }
        
        }

//adding laser charge
function laserCharge(x, y, a){
        push()
        translate(x, y);
        scale(a);
        image(laserEnergy, 0, 0);
        pop()

}

//adding laser beam
function laserFire(x, y, a, angle){
        push()
        translate(x, y);
        rotate(radians(angle));
        scale(-a, 1);
        image(laserBeam, -211, -0.5);
        pop()

}


Project – 09: Portrait

Using pointillism for different shapes. Before, I was trying to use different lines, but I wasn’t able to get it to work sadly.

sketch
After 1 minute
After 2 minutes
After 5 minutes
var sonia;
var smallPoint, largePoint;

function preload() {
    sonia = loadImage("https://i.imgur.com/3h0u1wQ.jpeg");
}
function setup() {
    createCanvas(480, 480);
    //creating variables for the smallPoint size and the largePoint size
    smallPoint = 4;
    largePoint = 20;
    noStroke();
    background(220);
    rectMode(CENTER)
}

function draw() {
    //created 6 x and y variables to hold different sizes of widths and heights based on the corresponding variable
    var x1 = floor(random(sonia.width));
    var y1 = floor(random(sonia.height));
    //-10 and +10 so that it would always draw a shorter line, so when I used get, it would get a color closer to the point.
    var x2 = floor(random(x1 - 10, x1 + 10));
    var y2 = floor(random(y1 -10, y1 + 10));
    var x = floor(random(sonia.width));
    var y = floor(random(sonia.height));
    var lineLength = ((y2 - y1) / (x2 - x1)) / 10;
    createMultipleLines(x1,y1, x2,y2);
    createMultipleRectangles(x,y);
    createMultiplePoints(x,y);
}

function createMultipleLines(x1, y1, x2, y2) {
    var pointillize = map(mouseX, 0, width, smallPoint, largePoint);
    //gets color
    var pix = sonia.get(x1,y1);
    var pix1 = sonia.get(x2,y2);
    stroke(pix);
    //random strokeWeight
    strokeWeight(random(0.1, pointillize));
    line(x1,y1,x2,y2);
}

function createMultipleRectangles(x,y) {
    //creates multiple rectangles using same method
    var pointillize = map(mouseX, 0, width, smallPoint, largePoint);
    print(sonia.width);
    print(sonia.height)
    var pix = sonia.get(x,y);
    fill(pix);
    noStroke();
    rect(x,y, pointillize, pointillize);
}

function createMultiplePoints(x,y) {
    //creates multiple circular points using same method.
    var pointillize = map(mouseX, 0, width, smallPoint, largePoint);
    print(sonia.width);
    print(sonia.height)
    var pix = sonia.get(x,y);
    fill(pix);
    noStroke();
    ellipse(x,y, pointillize, pointillize);
}
    


// function createTinyLines(x1,y1,x2,y2, lineLength) {
//     var pointillize = map(mouseX, 0, width, smallPoint, largePoint);
//     for (var i = 0; i< lineLength; i ++) {
//         var pix = sonia.get(x1,y1);
//         var pix1 = sonia.get(x2,y2);
//         stroke(pix);
//         line(x1,y1,x2,y2);
//         var slopeY = y2 - y1;
//         var slopeX = x2 - x1;
//         x1 = x2;
//         y1 = y2;
//         x2 += slopeX;
//         y2 += slopeY;
//     }
// }

// function createOneLine(x1,y1,x2,y2, lineLength) {
//     //var pointillize = map(mouseX, 0, width, smallPoint, largePoint);
//     var pix = sonia.get(x1,y1);
//     var pix1 = sonia.get(x2,y2);
//     stroke(pix);
//     for (var i = 0; i< 20; i ++) {
//         line(x1,y1,x2,y2);
//         var slopeY = y2 - y1;
//         var slopeX = x2 - x1;
//         x1 == x2;
//         y1 == y2;
//         x2 += slopeX;
//         y2 += slopeY;
    
//     }
    
// }

Project 09: Computational Portrait (Custom Pixel)

i used my portrait as an each pixel to create a whole portrait. I used smaller images for face & background section, but bigger and rotated images for hair and eye section to separate the section of my feature.

sketchDownload
// Alicia Kim
// yoonbink
// Section B

function preload(){ //load the image
    alicia = loadImage("https://i.imgur.com/FPEjcyO.jpeg");
}


function setup() {
    createCanvas(480, 480);
    imageMode(CENTER);
    angleMode(DEGREES);
    background(220);
    alicia.resize(480,480); //resize alicia to canvas size
    alicia.loadPixels(); //load pixels
}

function draw() {
    var x = floor(random(alicia.width)); //random x-coordinate value
    var y = floor(random(alicia.height)); //random y-coordinate value
    var pixColor = alicia.get(x,y); //get random coordinate in the canvas
    tint(pixColor); //tint with the color of that coordinate 

// divide sections by hair and the rest

    if (pixColor[0]>130) { //face & background has smaller images
        image(alicia,x,y,9,9);
    }

    if (pixColor[0]<130) { //hair section has bigger & rotated images 
        push();
        translate(x,y);
        rotate(180);
        image(alicia,0,0,13,13);
        pop();   
    }
}

LO 09: Women in Computational Art

I looked at the project A Global Retail Interactive for the brand On Running by Vera-Maria Glahn. Glahn is a digital artist who combines data art and immersive experiences to create immersive storytelling. This project is a digital wall of gradient colors with motion sensors that tracks the movement of people in front of it. I think this is a smart design for a running store because it allows interaction between the product of the store and the artistic installation design of the walls. The customer can try on the shoes and run across the wall and the wall would respond to the movement and create a biomechanical profile of their movement, resulting in digital art. When the customers return after their purchase they can run again and the digital wall can show how the shoe can improve their performance. This system is composed of multiple motion sensors that capture the running motion from 3 angles. I find it inspiring how digital programming can create a system that can both be useful to track and compare running data and create artistic art.

Link https://field.systems/work/on-running-try-on-global-retail-interactive