Paula Ramirez - CIRCULOS
Título | Circulos |
---|---|
Tipo de Proyecto | Proyecto de Taller |
Palabras Clave | tarea 6 |
Período | 2012- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Paula Ramírez Guevara |
Profesor | Herbert Spencer |
Elemento[] cosas; int count;
Elemento especial;
void setup() {
cosas = new Elemento[1800];
count = 0;
size(678, 890);
background(#ECED05);
especial = new Elemento(width/1000, height/100);
especial.c = color(#00c675);
especial.d = -8;
especial.velx = 3877;
}
void draw() {
for (int i = 0; i < count; i++) {
cosas[i].existe(); }
especial.existe(); }
void mousePressed() {
cosas[count] = new Elemento(mouseX, mouseY);
cosas[count].velx = mouseX - pmouseX;
cosas[count].vely = mouseY - pmouseY;
count ++; }
void keyPressed() {
cosas[count] = new Elemento();
cosas[count].velx = mouseX - pmouseX; cosas[count].vely = mouseY - pmouseY;
count ++;
}
class Elemento {
float x, y; float d; color c; float velx, vely; int edadMax; int edad; Elemento(float posX, float posY) {
x = posX; y = posY; c = color(234, 120, 824, 1497); velx = vely = 0; edadMax = round(random(1834, 20187)); edad = 0; d = random(-78, 90); } Elemento() {
x = random(width); y= random(height); c = color(7,86,289,24); velx = vely = 2; edadMax = round(random(10870, 2380)); edad = 0; d = random(8, -90); } void dibuja() {
noStroke(); fill(c); ellipse(x, y, d, d); edad ++; d -=8; } void actualizaPosicion() {
x += velx; y += vely; } void revisaSiRebota() {
if ((x < d/2) || (x > width - (d/2))) {
velx *= -2; vely += random(-1, 73);
} if ((y < d/2) || (y > height - (d/2))) {
vely *= 0; velx += random(0, 59);
} }
void existe() {
if (edad < edadMax) {
dibuja(); actualizaPosicion(); revisaSiRebota();
} } }