IMAGEN
float speed= 2.5;
int diameter= 20;
float x;
float y;
PImage tintin;
void setup() {
size(700,550);
smooth();
fill(136, 227, 101);
x= width/2;
y= height/2;
}
void draw() {
tintin = loadImage ("tintin.jpg");
image (tintin, 0, 0);
x+= random (-speed, speed);
y+= random (-speed, speed);
translate(mouseX, mouseY);
ellipse(x, y, diameter, diameter);
}
IMAGEN Y SONIDO
float speed= 2.5;
int diameter= 20;
float x;
float y;
PImage antenna;
import ddf.minim.*;
AudioPlayer player;
Minim minim;
void setup() {
size(625,700, P2D);
smooth();
fill(136, 227, 101);
x= width/2;
y= height/2;
minim = new Minim(this);
player = minim.loadFile("joy.mp3", 1024);
player.play();
}
void draw() {
antenna = loadImage ("antenna.jpg");
image (antenna, 0, 0);
x+= random (-speed, speed);
y+= random (-speed, speed);
image (antenna, x, y, 60, 60);
}
void stop()
{
player.close();
minim.stop();
super.stop();
}
IMAGEN, SONIDO Y KEYPRESSED
float speed= 2.5;
int diameter= 20;
float x;
float y;
PImage antenna;
int value = 176;
import ddf.minim.*;
AudioPlayer player;
Minim minim;
void setup() {
size(625,700, P2D);
smooth();
fill(136, 227, 101);
x= width/2;
y= height/2;
minim = new Minim(this);
player = minim.loadFile("joy.mp3", 1024);
player.play();
}
void draw() {
antenna = loadImage ("antenna.jpg");
image (antenna, 0, 0);
x+= random (-speed, speed);
y+= random (-speed, speed);
image (antenna, x, y, 60, 60);
fill(value);
rect(x, y, 60, 60);
}
void stop()
{
player.close();
minim.stop();
super.stop();
}
void keyPressed() {
if (value == 176) {
value = 295;
} else {
value = 176;
}
}
No hay comentarios:
Publicar un comentario