martes, 5 de mayo de 2015

Red Ballon animation code for processing

float bs = 0; // balloon size

int cellsize = 2; // Dimensions of each cell in the grid
int columns, rows;

void setup() {
 size(600,690);
 background(0);
}

void draw() {
 background(0);
 triangleShape();
 fill(255,0,0);
 stroke(255,0,0,0);
 ellipse(width/2, (300)-15, bs, bs*1.2);
 arc(width/2, 280, bs, (150)+(1.5*bs), 0,PI); // 180 degrees


 if (mousePressed) {
 bs += 1; // change value for different grow rates
 }else if(bs >0){
 bs -= 2;
 }
}

void triangleShape(){

 if(bs<300){
 if(bs<20 && bs >=0){
 fill(0,0,0);
 stroke(0,0,0,100);
 }
 else{
 fill(255,0,0);
 stroke(255,0,0,0);
 }
 }else{
 print("HELLOOOOO");
 }

 triangle(width/2,300+bs/(4*PI),290,310+bs,310,310+bs);

}

No hay comentarios:

Publicar un comentario