miércoles, 16 de noviembre de 2011

PImage imagen;
void setup(){
size(400,450,P3D);
imagen = loadImage("tipas.jpg");
noStroke();

background(0);

}
void draw(){

color este;
int x = int( random(400) );
int y = int( random(450) );
este = imagen.get( x , y );
fill( red(este) , green(este) , blue(este) , 100 );

float lado = random(3,20);
smooth();
noLights();
translate( x , y , lado );
sphere(10);

}
void mousePressed(){
background(255);

}





PImage imagen;
void setup(){
size(400,450);
imagen = loadImage("tipas.jpg");
noStroke();

background(0);

}
void draw(){

color este;
int x = int( random(400) );
int y = int( random(450) );
este = imagen.get( x , y );
fill( red(este) , green(este) , blue(este) , 100 );
stroke(este);
float lado = random(3,20);
smooth();
ellipse( x , y, lado , lado );
}
void mousePressed(){
background(0);

}



martes, 15 de noviembre de 2011

3D para examen

void setup(){

    size(500,500,P3D);
    background(#FFD700);
    fill(#C71585);

}
void draw(){

   
  translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
   
    sphere(30);
   
}
void mousePressed(){

    background(#C71585);
    fill(#FFD700);
    translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
    sphere(30);
   

}

void keyPressed(){

    background(#FFD700);
    fill(#C71585);
    translate( random(width) , random(height) , 0 );

lights();
noStroke();
   
    sphere(30);

}





practicando 3D para EXAMEN


void setup(){
size(500,500,P3D);
background(0);
stroke(255,150,20);
smooth();
lights();
}

void draw(){

translate(300, 250, 62);
rotateY(0.6);
rotateX(0.6);
box(120);
sphere(85);

translate(-150, -100, 0);
sphere(33);

translate(120, -100,0);
sphere(55);

translate(-120,250,0);
sphere(20);

}
void mousePressed() {
  translate(mouseX,mouseY,1);
sphere(20);
}

algo de variables


int x=150;


void setup() {
size(200,200);
background(#269884);
}
void draw() {
if(mousePressed){
line(20,20,180,180);
fill(#5CF511);
ellipse(100,100,20,20);
}

else{
fill(#C10225);
ellipse(50,50,90,90);
ellipse(150,150,90,90);
fill(#FC8B00);
triangle(20,30,80,10,60,90);
triangle(180,120,160,110,180,100);
}
}
PImage diosa;
PImage catrina;
float speed=2.5;
int diameter=20;
float x;
float y;
import ddf.minim.*;

AudioPlayer player;
Minim minim;



void setup () {
// background(204,210,30);
size(334,450);
diosa = loadImage("diosa.jpg");
catrina = loadImage("catrina.jpeg");
smooth();
x = width/2;
y = height/2;
}


void draw () {

image(diosa,0,0);
x += random(-speed,speed);
y += random(-speed,speed);
image(catrina,70,0,x,y);

}


void stop()
{

player.close();
minim.stop();

super.stop();
}

void mousePressed(){

minim = new Minim(this);
player = minim.loadFile("viva la gloria.mp3", 2048);
player.play();
}

void keyPressed() {
player.close();
minim.stop();

super.stop();

}



ejercicios de capas

size(480,120);
rect(160,30,260,20);
ellipse(140,8,190,190);







size(480,120);
smooth();
stroke(#99FF00);
ellipse(140,8,190,190);
rect(160,30,260,20);




size(480,120);
smooth();
ellipse(140,8,190,190);
stroke(#99FF00);
rect(160,30,260,20); 



size(480,120);
smooth();
stroke(#99FF00);
strokeWeight(20);
ellipse(140,8,190,190);
rect(160,30,260,20);