Something Cute I Hope

Mouse position changes facial structure, arms follow mouse position and when clicked, color changes. It laughs if it is “tickled” by the mouse.
Something Cute I Hope

int skinColorR = 100;
int skinColorG = 200;
int skinColorB = 300;

void setup() {
  size(600, 600);
}

void draw() {
  background(#ffffff);
  smooth();

  float randxymin = 85;
  float randxymax = 130;

  float randXL = map(mouseX, 0, width, randxymin, randxymax);
  randXL = constrain(randXL, randxymin, randxymax); 
  float randXR = map(width-mouseX, 0, width, randxymin, randxymax);
  randXR = constrain(randXR, randxymin, randxymax); 
  float randYT = map(mouseY, 0, height, randxymin, randxymax);
  randYT = constrain(randYT, randxymin, randxymax);
  float randYB = map(height-mouseY, 0, height, randxymin, randxymax);
  randYB = constrain(randYT, randxymin, randxymax);

  float randXS = map(mouseX, 0, width, 10, 40);
  randXS = constrain(randXS, 10, 40); 
  float randYS = map(mouseY, 0, height, 10, 40);
  randYS = constrain(randYS, 10, 40); 

  //define features
  float eyeSize = (randXS+randYS)/2; 
  float faceWidth = randXL; 
  float faceHeight = randYT;


  //draw features
  strokeWeight(1);
  fill(skinColorR, skinColorG, skinColorB);
  ellipse (width/2, height/2, faceWidth, faceHeight); 
  filter(BLUR, 3);
  float eyeLX = width/2 - faceWidth*0.15;
  float eyeRX = width/2 + faceWidth*0.15;
  fill(#ffffff);
  if ((mouseX>=((width/2)-(faceWidth/2))) && (mouseX< =((width/2)+(faceWidth/2))) 
  && (mouseY>=((height/2)-(faceHeight/2))) && (mouseY< =((height/2)+(faceHeight/2)))) {
    noFill(); 
  strokeWeight(2);
  arc(eyeLX, height/2-faceHeight*0.1, 20, 10, PI, TWO_PI);
  arc(eyeRX, height/2-faceHeight*0.1, 20, 10, PI, TWO_PI);
  } else {
    ellipse (eyeLX, height/2-faceHeight*0.1, 20, eyeSize); 
    ellipse (eyeRX, height/2-faceHeight*0.1, 20, eyeSize);
    fill(0, 0, 0);
    ellipse (eyeLX, height/2-faceHeight*0.1, 8, 8); 
    ellipse (eyeRX, height/2-faceHeight*0.1, 8, 8); 
  }
  strokeWeight(1);
    fill(0, 0, 0);
  if ((mouseX>=((width/2)-(faceWidth/2))) && (mouseX< =((width/2)+(faceWidth/2)))) {
    if ((mouseY>=((height/2)-(faceHeight/2))) && (mouseY< =((height/2)+(faceHeight/2)))) {
      float mouthHeight = random(10, 30);
      arc(width/2, height/2+faceHeight*0.1, 30, mouthHeight, 0, PI, PIE);
    }
  }
    float MXS = map(mouseX, 0, width, -100, 100);
  MXS = constrain(MXS, -100, 100); 
 float MYS = map(mouseY, 0, height, -100, 100);
  MYS = constrain(MYS, -100, 100); 

    float space1 = random(-3,3);
    float space2 = random(-3,3);
  
    float armLength = 40;
    float LarmStartX = width/2-faceWidth*0.38;
    float LarmStartY = height/2+faceHeight*0.05;
   float LarmMidInsideX = (width/2)-70+MXS*.5+space2/3;
   float LarmMidInsideY = (height/2)+50+MYS+space1/3;
   float LarmMidOutsideX = LarmMidInsideX+(MXS);
   LarmMidOutsideX = constrain(LarmMidOutsideX,LarmStartX-armLength*.8,LarmStartX+armLength*.8);
   float LarmMidOutsideY = LarmMidInsideY+(MYS);
      LarmMidOutsideY = constrain(LarmMidOutsideY,LarmStartY-armLength*.8,LarmStartY+armLength*.8);
   float LarmEndX = mouseX-10;
   LarmEndX = constrain(LarmEndX,LarmStartX-armLength,LarmStartX+armLength)+space1;
   float LarmEndY = mouseY-10;
   LarmEndY = constrain(LarmEndY,LarmStartY-armLength,LarmStartY+armLength)+space2;
  
  
   float RarmStartX = width/2+faceWidth*0.38;
    float RarmStartY = height/2+faceHeight*0.05;
   float RarmMidInsideX = (width/2)+70+MXS*.5+space2/3;
   float RarmMidInsideY = (height/2)+50+MYS+space1/3;
   float RarmMidOutsideX = RarmMidInsideX+(MXS*.5);
   RarmMidOutsideX = constrain(RarmMidOutsideX,RarmStartX-armLength*.8,RarmStartX+armLength*.8);
   float RarmMidOutsideY = RarmMidInsideY+(MYS*.5);
   RarmMidOutsideY = constrain(RarmMidOutsideY,RarmStartY-armLength*.8,RarmStartY+armLength*.8);   
   float RarmEndX = mouseX+10;
   RarmEndX = constrain(RarmEndX,RarmStartX-armLength,RarmStartX+armLength)+space2;
   float RarmEndY = mouseY-10;
   RarmEndY = constrain(RarmEndY,RarmStartY-armLength,RarmStartY+armLength)+space1;
  
  noFill();
  stroke(0);
  strokeWeight(3);
  bezier(LarmStartX, LarmStartY, 
  LarmMidInsideX, LarmMidInsideY,//height/2+faceHeight*0.8, 
  LarmMidOutsideX, LarmMidOutsideY, LarmEndX, LarmEndY);
  bezier(RarmStartX, RarmStartY, 
  RarmMidInsideX, RarmMidInsideY,//height/2+faceHeight*0.8, 
  RarmMidOutsideX, RarmMidOutsideY, RarmEndX, RarmEndY);
}

void mousePressed() {
  skinColorR = int(random (0, 255));
  skinColorG = int(random (0, 255));
  skinColorB = int(random (0, 255));
}

The Enemies

the enemies virus New Version

 

chaos and order

The Enemy
When given the theme of working with chaos and order, for some reason my mind immediately went back to viruses. I wanted to create a program where on the surface the objects appeared to be ordered and calm but when the user interacted with it became a chaotic frenzy. With that in mind I set out to create the ‘enemies’, viruses that would scramble as the user pressed the screen and moved the mouse from the top of it to the bottom. Honestly my biggest obstacle was creating the actual shape of the virus. I used the createShape() function but really had a difficult time picturing where I would plot the points that made my shape come together. It was a lot of guess work which I found troublesome, especially because for some reason, the tweak mode on processing wasn’t working for my computer. After that I created a loop that repeated the image of the virus over an increment of 100 on the y value, in order to space it out. Then I mapped the movement of the y value on the mouse so that as the user when down it became more chaotic. I used a constraint to make the top of the screen the most static. I also made it so that as long as the mouse wasn’t pressed the viruses won’t move. I did this by creating an if statement that was dependent on the Boolean move which functioned to make the viruses move only if the mouseisPressed function was true.

*EDITED: I created a gif of the project working and also resized the viruses so they are smaller and there are more of them. This change can be seen in the gif and in the code below.

 

//order mouseX= left chaos mouseX is right
float x=0;
float y=0;
float xmove;
float trying;
float trying2;
boolean moving= false;

void setup(){
  size(400,405); 
  
}

void draw(){
  smooth();
  background(255,15,72);
  
 
  xmove= map(0,mouseY,1,height,0);
  xmove= constrain( xmove,1,0);
 
  for( x=0; x< =width*20; x+=100){
    for( y=0; y<=height*20; y+=200){
      
      
        trying= x + xmove*random(-30,30);
        trying2= y+ xmove*random(-30,30);
        
          
if (mousePressed==true){//will run the code as long as the mouse is held down
   
           x=trying;
         y=trying2;
        }
    
  stroke(5);
  
  fill(132,199,44);
  //headvirus
  
 
beginShape();
//triangle 1 top
vertex((x)/3,(y+50)/3);//outsidebeginingline
vertex((x+50)/3,(y+15)/3);
vertex((x+100)/3,(y+50)/3);
vertex((x)/3,(y+50)/3);

//triangle2bottom

vertex((x+50)/3,(y+100)/3);
vertex((x+100)/3,(y+50)/3);

endShape();
line((x+50)/3,(y+15)/3,(x+50)/3,(y+100)/3);

fill(0,0,182);
//bottom virus;
beginShape();
vertex((x+25)/3,(y+100)/3);
vertex((x+75)/3,(y+100)/3);
vertex((x+75)/3,(y+200)/3);
vertex((x+25)/3,(y+200)/3);
vertex((x+25)/3,(y+100)/3);
endShape(); 

stroke(0,0,0);
line((x+25)/3,(y+200)/3,(x+15)/3,(y+215)/3);
line((x+45)/3,(y+200)/3,(x+35)/3,(y+215)/3);
line((x+55)/3,(y+200)/3,(x+65)/3,(y+215)/3);
line((x+75)/3,(y+200)/3,(x+85)/3,(y+215)/3);
    }//inloop
  }//ousideloop
  

}//end draw

 

Jingle Balls

Not really music to anyone’s ears…

import ddf.minim.*;
import ddf.minim.ugens.*;

Minim       minim;
AudioOutput out;
Oscil       wave;

void setup(){
  size(1000,500); 
  minim = new Minim(this);
  out = minim.getLineOut();
  wave = new Oscil( 300, 0.5f, Waves.SINE );
  wave.patch( out );
}
 
void draw(){
  background(255);
  smooth(); 
 
 //golan's randomness
  float randomness = map(mouseX, 0,width, 0,1);
  randomness = constrain(randomness, 0,1);
 
  for (int i=1; i

Wallpaper

Gif of wallpaper Gif of wallpaper

 

wallpaper

Wallpaper

When making this piece I didn’t really have a specific visualization of what I wanted the piece to look like as much as I did a color scheme I wanted to work around. I wanted to create something that was dynamic that worked with the scheme of red, black, yellow and white. What I did first was create an ellipse which I repeated across a boundary of fifty, by fifty using a loop. I did the same thing for the smaller ellipse located inside it. Another thing I added was a series of lines, also created by a for loop. These lines ran from opposite corners of the image, one from a negative section beyond the canvas and another from the width of it. I also made the colors of another series of lines I created-along with the inside circles—running through the bottom left and top right corner of the canvas to change from a random number from 1 to 121 and changed the blue and green value of the stroke, creating different shades of yellow.

 EDITED: I added a moving gif of the wallpaper and also changed the parameters of the circles and lines being drawn so that they aren’t confined to the space which can be seen in the new version of the code below.

import processing.video.*;

void setup(){
 size(500,500);
 background(255,2,14);
frameRate(5);

}

void draw(){

 float cu= random (1,121);

for (int x = 0; x< =width; x+=40){//creating a shape from width minus wall (50) and continues until it reacheds wall(50) 
//meaning 800-50=750 so from 750 up over and over again until it reaches 50
  for(int y = 0; y<height; y+=40){//doing the same thing
  noStroke();
   
    
   fill(0,0,0);
   ellipse(x-1, y-1, 50,50);
   fill(255,cu,0);
   ellipse(x+1,y+1, 15,15);
   
   stroke(5);
   
   line(x,y,-x,-y);//all going towards a negative number somewhere
   stroke(255,255,255);
   line(2*x,2*y,-x,-y);
   stroke(255,cu,cu);
   line(4*y, 4*x,-x,-y);//line four times as much as x and y going to a negative number
   stroke(0,0,0);
   line(width,height,x,y);//lines coming from the end of the screen to x and y
   
   stroke(255,cu*2,cu);
   line(4*width, 4*height,-x,-y);
   
 

    }
  }
}

&nbsp;

Little Boy

little boyfin Gif of piece

 

 

Little Boy screenshot Little Boy
I imagine this program to be an overbearing aunt pulling the cheek of a little boy and the faces he makes at the incredibly uncomfortable situation. I linked the top of his hat to his actual face so it would stretch along with his cheeks and constrained the pupils in the eyes by creating an if statement that would resize them if the random generator ever attempted to make them greater than the size of the whites. I allowed for them to be equal however. I did a similar function for the blush, also randomizing the shade of the alpha.

EDITED: I added a moving gif of the project

 

float m1= 50;//whites of eyes
float resize=150;//adding to face shape
float mou= 55;//mouth 
float fshape=450;
float leftfa=100;//changing the width of left side of face
float rightfa=500;//changing width of right side of face

float leftcap=leftfa;
float rightcap=rightfa;//making sure when clicked the right side of cap is connected to the right side of face


float bball=25;//pupil
//creating shape group
float blush=25;//blush size
float shadeblush=93;//shade of pink of blush
float visblush=0;//alpha value of blush
float blushheight=190;


void setup(){
size(600,600);

}

void draw(){
  translate(0, 100);
background(108,155,224);

//drawing face
beginShape();
fill(165,68,10);
stroke(3);
curveVertex(resize,100);
curveVertex(leftfa,100);
  
curveVertex(resize,300);
curveVertex(fshape,300);
  
  
curveVertex(rightfa,100);
curveVertex(450,100);
endShape(CLOSE);
  
   
   // drawing cap cap

beginShape();
fill(0,0,255);
stroke(10);
  
curveVertex(150,300);
curveVertex(leftcap,100);
  
curveVertex(300,25);
  
curveVertex(rightcap,100);
curveVertex(450,300);

endShape(CLOSE); 
  
  //top of cap
 

beginShape();//inside cap skin
fill(165,68,10);
stroke(10);
  
curveVertex(250,100);
curveVertex(250,80);
  
curveVertex(300,55);
  
curveVertex(350,80);
curveVertex(350,100);

endShape(CLOSE); 
     
//eye1 
fill(255,255,255);
ellipse(375,150,m1,m1);
//eye2
ellipse(200,150,m1,m1);
  
  fill(0,0,0);
 //eyeball1
ellipse(375,150,25,bball);
  
 //eyeball2
ellipse(200,150,25,bball);
  
//mouth
rect(255, 200,mou,m1);
  
//blush

noStroke();
fill(210,shadeblush,151,visblush);
ellipse(200,blushheight,75,blush);
ellipse(400,blushheight,75,blush);

}



 void mousePressed(){
m1= random(100);

mou= random(100);
bball= random(25,75);
if (bball>=m1){//making sure the pupils is less then or equal to the size of the eye
  bball=25;
}

if (m1==50){//making sure the blush isn't ontop of pupil
  blushheight= 200;

}if (m1>=50){
  blushheight=225;}
  else{
  blushheight=190;
}

resize= random(150,200);
leftfa= random(100);//changing width position of left side of face
rightfa= random(500,600);

leftcap= leftfa;
rightcap= rightfa;
shadeblush= random(129);
visblush= random(0,129);

}

Financial Seismograph

Based on your control and data ripped from live stock trades the financial seismograph is meant to disorient and remind the user of the fragile nature of their financial system by allowing them to control the chaotic state of their world’s digital representation.

(The live data doesn’t work yet, but it will soon…)

Stock stockValue;

int prevSign = 0;

int centerScreenX;
int centerScreenY;

void setup() {
  size(1200,500);
  background(100);
  stockValue = new Stock();
  centerScreenX = displayWidth/2 - (width/2);
  centerScreenY = displayHeight/2 - (height/2);
  ellipseMode(CENTER);
  
}


void draw() {
  background(100);
  drawBackground();
  drawTicker();
  if (frameCount % 1 == 0) {
    makeStock();
  }
  makeLines();
  updateStock();
  frame.setLocation(centerScreenX,centerScreenY + stockValue.change);
  drawSeismo();
  //drawStock(); 
}

void drawBackground() {
    for (int x = 0; x < width; x += width/10) {
        stroke(127);
        line(x,0, x,height);
    }
    for (int y = 0; y < height; y += height/10) {
        line(0, y, width, y);
    }
}   

void mousePressed() {
  stockValue.y = height/2;
}

void drawSeismo() {
  line(width,height/2, stockValue.x,stockValue.y);
  fill(0);
  ellipse(width,height/2,height/20,height/20);
}

void drawTicker() {
  strokeWeight(2);
  stroke(color(map(stockValue.average, height/2, height, 0, 155)+100, 0,0));
  line(0,stockValue.average, int(width), stockValue.average);
}

void makeLines() { 
  for (int i = 0; i &lt; circleList.size(); i++) {
    if (i &gt; 0) { 
      Circle left = circleList.get(i-1);
      Circle right = circleList.get(i);
      Line currLine = new Line(left.x,left.y,right.x, right.y,right.fillColor);
      currLine.drawMe();
    }
  }
}

  
void makeStock() {
  circleList.add(new Circle(stockValue.x,stockValue.y));
}

void updateStock() {
  int total = 0;
  for (Circle circ: circleList) {
    circ.move(circ.velX, circ.velY);
    circ.formatPos();
    total += circ.y;
    circ.update();
  }
  
  for (int i =0; i &lt; circleList.size(); i++) {
    if (!(circleList.get(i).alive)) {
      circleList.remove(i);
    }
  }
  stockValue.update();
  stockValue.average = total /(circleList.size()+1);
}

void drawStock() {
  for (Circle circ: circleList) {
    circ.drawMe();
  }
}


class Stock {
  int change;
  int x;
  int y;
  float average;
  int prevSign;
  int prevVal;
  int valChange;
 
  Stock() {
    this.x = int(width * .9);
    this.y = int(height * .5);
    this.change = 0;
    this.valChange = this.y;
    this.prevSign = 1;
    this.prevVal = this.y;
  }
 
  void update() {
    this.change = this.checkChange();
    this.y += change;  
  }
  
  int checkChange() {
    float changeConstant = .2; //Value between 1 and 0, higher numbers = rapid changes
    float upperBound = height * changeConstant ;
    int ratio = int(map(mouseX, 0,width,0,upperBound));
    
    int sign;
    int check;

    float a1 = height * .1;
    float a2 = height * .2;
    float b2 = height * .8;
    float b1 = height * .9;
    
    if (stockValue.y &lt; 0) {
      check = 0;
    } else if (stockValue.y &lt; a1) {
      check = 1;
    } else if (stockValue.y &lt; a2) {
      check = 3;
    } else if (stockValue.y &gt; height) {
      check = 10;
    } else if (stockValue.y &gt; b2) { 
      check = 9;
    } else if (stockValue.y &gt; b1) {
      check = 7;
    } else {
      check = 5;
    }
    
    float randomNum = random(0,10);
    if (randomNum &lt; check) {
      sign = -1;
    } else {
      sign = 1;
    }
    
    if (sign != this.prevSign) {
      this.valChange = this.prevVal + int(map(this.y,0,height,height/2,0)) - height/2;
    }
      
    float smallestChange = random(ratio/5.0);
    int largestChange = ratio;
    
    return sign * (int(random(smallestChange,largestChange)));
  }
}

class Shape {
  int x;
  int y;
  int regX;
  int regY;
  color fillColor = color(0);
  int sWeight = 1;
  boolean alive = true;
  int diameter;
  int velX;
  int velY;
  
  Shape(int x, int y) {
    this.regX = x;
    this.regY = y;
    this.formatPos();
  }
  
  void move(int xVel,int yVel) {
    this.regX += xVel;
    this.regY += yVel;
  }
  
  void check() {
    if ((this.x + this.diameter) &lt; 0) {
      this.alive = false;
    }
  }
      
  void update() {
    this.check();
  }
  
  void formatPos() {
    this.y = this.regY + stockValue.change;
    this.x = this.regX;
  }
}
  
class Circle extends Shape {
  int size;
  int velY;
  int velX;
  int diameter;
  
  Circle(int x, int y) {
    super(x,y);
    this.size = 5;
    this.velY = 0;
    this.velX = -1;
    this.diameter = this.size;
    this.fillColor = this.chooseColor();
  }
  
  void drawMe() {
    fill(this.fillColor);
    noStroke();  
    ellipse(this.x, this.y, this.size, this.size);
  }
  
  color chooseColor() {
    return color(map(this.y, height/2, height, 0, 155)+100, 0,0);
  }
}

class Line extends Shape {
  int x1;
  int y1;
  int x2;
  int y2;
  color strokeColor;
  
  Line(int x1, int y1, int x2, int y2, color strokeColor) {
    super(x1,y1);
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
    this.strokeColor = strokeColor;
  }
  
  void drawMe() {
    stroke(this.strokeColor);
    line(this.x1, this.y1, this.x2, this.y2);
  }
}

It’s not Matt

mbk-variableface

At first I was attempting to draw variable cat faces that could go from kittens to lions, but after spending a tremendous amount of time realizing that the curves in p5js aren’t filled right, I went back to attempt a simpler project with the time I had remaining. The variable features of this project are the eye position, nose size, mouth smirking, and the widows peak and messiness of the hair.

Generated PseudoEnglish

I created a sentence generator which chooses which letter comes next based on the most likely letter to follow it in English words. When the mouse is on the left side (order), the probability is always taken into account, and the words generated fall within normal linguistic patterns of English. As the mouse moves further to the right, however, the next character becomes random, and symbols from outside of the alphabet begin to appear.
chaosnorda

Parametric Faces

I really butchered any sort of expressiveness that a face should be capable of. My sketch creates faces with a variable amount of eyes, situated around an eternally apathetic mouth of variable width. These two factors are randomized using the Perlin noise function provided by Processing. To show the contrast between noise and pure randomness, I made the size of the faces vary completely randomly.

sketch (1)

Wallpaper

sketch23

With this, I wanted to make something that was visually pleasing with a small amount of coding, by disguising something that is really simple as something more complicated. At first glance this looks like it might be in 3d, or have complex shapes in it, but its just 2d circles stacked up on each other. I want to exercise the ability to code concisely, keeping everything simple and painfully clear at the base and then build up on that. So this defiantly would be a base for a bigger project.