Imagen Escrita, tarea 6, FranciscaRomero
Título | Tarea 6, imagen escrita, Francisca Romero B |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 6 |
Del Curso | Imagen Escrita 2012, |
Carreras | Diseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property. |
Alumno(s) | Francisca Romero Bugueño |
//basado en ejemplo de clases
Elemento[] cosas; int count;
Elemento especial;
void setup() {
cosas = new Elemento[20]; count = 0; size(700,700); background(#AEB205); especial = new Elemento(width/1, height/1); especial.c = color(#04B404, 255); especial.d = 1; especial.velx = 1; especial.vely = 10 ; especial.edadMax = 3000; }
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+5; cosas[count].vely = mouseX - pmouseY+15; count ++; }
void keyPressed() {
cosas[count] = new Elemento(); 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(#E51E1E, #0FF28D, #E60FF2, #FCF105); velx = vely = 0; edadMax = round(random(10, 10)); edad = 0; d = random(1, 50);
} Elemento() {
x = random(width); y = random(height); c = color(#04B404, 80, 115, 20); velx = vely = 10; edadMax = round(random(100, 200)); edad = 0; d = random(1, 30);
} void dibuja() {
noStroke(); fill(c); ellipse(x+2,y+3, 10, 50); edad ++; d -= 50;
} void actualizaPosicion() {
x += velx; y += vely;
} void revisaSiRebota() {
if ((x < d/100) || (x > width - (d/100))) { velx *= -1; vely += random(-1, 1); } if ((y < d/70) || (y > height - (d/70))) { vely *= -1; velx += random(-1, 1); }
} void existe() {
if (edad < edadMax) { dibuja(); actualizaPosicion(); revisaSiRebota(); }
} }