Diferencia entre revisiones de «Imagen Escrita, tarea 6, FranciscaRomero»

De Casiopea
Sin resumen de edición
Sin resumen de edición
 
Línea 4: Línea 4:
|Palabras Clave=tarea 6
|Palabras Clave=tarea 6
|Carreras Relacionadas=Diseño Gráfico, Diseño Industrial
|Carreras Relacionadas=Diseño Gráfico, Diseño Industrial
|Asignaturas Relacionadas=Taller Inicial Común 1ª y 2ª Etapa,  
|Asignaturas Relacionadas=Taller Inicial Común 1ª y 2ª Etapa,
|Cursos Relacionados=Imagen Escrita 2012,
|Cursos Relacionados=Imagen Escrita 2012,
|Alumnos=Francisca Romero Bugueño,
|Alumnos=Francisca Romero Bugueño,
|Imagen=Francisca Romero, tarea 6.jpg
}}
}}
<pre> <nowiki>
//basado en ejemplo de clases
//basado en ejemplo de clases


Elemento[] cosas; int count;
Elemento[] cosas;  
int count;


Elemento especial;
Elemento especial;
Línea 16: Línea 20:
void setup() {
void setup() {


cosas = new Elemento[20];
  cosas = new Elemento[20];  
count = 0;
  count = 0;  
size(700,700);
  size(700, 700);  
background(#AEB205);
  background(#AEB205);  
especial = new Elemento(width/1, height/1);
  especial = new Elemento(width/1, height/1);  
especial.c = color(#04B404, 255);
  especial.c = color(#04B404, 255);  
especial.d = 1;
  especial.d = 1;  
especial.velx = 1;
  especial.velx = 1;  
especial.vely = 10 ;
  especial.vely = 10 ;  
especial.edadMax = 3000;
  especial.edadMax = 3000;
}
}


void draw() {
void draw() {


for (int i = 0; i < count; i++) {
  for (int i = 0; i < count; i++) {
  cosas[i].existe();
 
}
    cosas[i].existe();
especial.existe();
  }  
  especial.existe();
}
}


void mousePressed() {
void mousePressed() {


cosas[count] = new Elemento(mouseX, mouseY);
  cosas[count] = new Elemento(mouseX, mouseY);  
cosas[count].velx = mouseX - pmouseX+5;
  cosas[count].velx = mouseX - pmouseX+5;  
cosas[count].vely = mouseX - pmouseY+15;
  cosas[count].vely = mouseX - pmouseY+15;  
count ++;
  count ++;
}
}


void keyPressed() {
void keyPressed() {


cosas[count] = new Elemento();
  cosas[count] = new Elemento();  
count ++;
  count ++;
}
}


Línea 53: Línea 58:
class Elemento {
class Elemento {


float x, y;  
  float x, y;  
float d;  
  float d;  
color c;  
  color c;  
float velx, vely;  
  float velx, vely;  
int edadMax;
  int edadMax;  
int edad;  
  int edad;  
Elemento(float posX, float posY) {
  Elemento(float posX, float posY) {
  x = posX;
 
  y = posY;
    x = posX;
  c = color(#E51E1E, #0FF28D, #E60FF2, #FCF105);
    y = posY;
  velx = vely = 0;
    c = color(#E51E1E, #0FF28D, #E60FF2, #FCF105);
  edadMax = round(random(10, 10));
    velx = vely = 0;
  edad = 0;
    edadMax = round(random(10, 10));
  d = random(1, 50);
    edad = 0;
}
    d = random(1, 50);
Elemento() {
  }  
  x = random(width);
  Elemento() {
  y = random(height);
 
  c = color(#04B404, 80, 115, 20);
    x = random(width);
  velx = vely = 10;
    y = random(height);
  edadMax = round(random(100, 200));
    c = color(#04B404, 80, 115, 20);
  edad = 0;
    velx = vely = 10;
  d = random(1, 30);
    edadMax = round(random(100, 200));
}
    edad = 0;
void dibuja() {
    d = random(1, 30);
  noStroke();
  }  
  fill(c);
  void dibuja() {
  ellipse(x+2,y+3, 10, 50);
 
  edad ++;
    noStroke();
  d -= 50;
    fill(c);
}
    ellipse(x+2, y+3, 10, 50);
void actualizaPosicion() {
    edad ++;
  x += velx;
    d -= 50;
  y += vely;
  }  
}
  void actualizaPosicion() {
void revisaSiRebota() {
 
  if ((x < d/100) || (x > width - (d/100))) {
    x += velx;
    velx *= -1;
    y += vely;
    vely += random(-1, 1);
  }  
  }
  void revisaSiRebota() {
  if ((y < d/70) || (y > height - (d/70))) {
 
    vely *= -1;
    if ((x < d/100) || (x > width - (d/100))) {
    velx += random(-1, 1);
      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();
    }
   }
   }
}
}
void existe() {
 
  if (edad < edadMax) {
</nowiki> </pre>
    dibuja();
    actualizaPosicion();
    revisaSiRebota();
  }
}
}

Revisión actual - 23:36 30 may 2012

Tarea 6, imagen escrita, Francisca Romero B


TítuloTarea 6, imagen escrita, Francisca Romero B
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 6
AsignaturaTaller Inicial Común 1ª y 2ª Etapa,
Del CursoImagen Escrita 2012,
CarrerasDiseñ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();
    }
  }
}