Ser Generativo SP: Ejemplo de Evolución Creativa
EVOLUCIÓN CREATIVA
El principio en el que se basa la idea de Evolución Creativa es conseguir que un elemento creativo sea capaz de evolucionar en función del paso del tiempo.
Dicho de otro modo, mostrar algo que presenta diferentes aspectos o comportamiento conforme avance el tiempo.
Ya no hablaríamos del típico Arte Generativo que mostrase siempre la misma creación sino, mas bien, la creación evolucionaría conforme es contemplada.
En este ejemplo, simple pero eficaz, he resumido el tiempo en tres etapas:
- Niñez: Triángulo.
- Adulto: Cuadrado.
- Anciano: Círculo.
CÓDIGO
//(C)Sergio Salazar Latorre
//Ser Generativo
//Definicion de la Clase: Evolucion de forma
let ns=10
let sg= Array(ns)
let l =500
let fase=100
let s
let pc1=2
let pc2=2
let pc3=2
function setup() {
createCanvas(l,l);
for(let i=0; i<ns; i++){
sg[i] = new SerGenerativo(random(0,l),
random(0,l))
}
}
function draw() {
background(0);
noFill()
stroke(255)
for(let i=0; i<ns; i++){
sg[i].dibujarSer()
}
push()
stroke(0)
strokeWeight(2)
fill(255)
text("(C)Sergio Salazar Latorre", 10,l-12*2)
text("Ser Generativo Sistema de Particulas",10, l-12)
pop()
}
class SerGenerativo{
constructor(x,y){
this.x=x
this.y=y
this.pc1=pc1
this.pc2=pc2
this.pc3=pc3
this.estado=1
this.edad=1
}
verEstado(){
if(this.edad>fase*3){
this.estado=3 //Anciano
} else if(this.edad>fase*2){
this.estado=2 //Adulto
} else {
this.estado=1 //Niño
}
return this.estado
}
dibujarSer(){
this.edad++
if(this.estado==1){
triangle(this.x,this.y,
this.x+this.pc1,
this.y-this.pc1,
this.x+this.pc1*2,this.y)
this.pc1+=pc1
} else if(this.estado==2){
square(this.x,this.y, this.pc2)
this.pc2+=pc2
} else {
circle(this.x,this.y, this.pc3)
this.pc3+=pc3
if(this.pc3>50){
this.estado=1
this.pc1=pc1
this.pc2=pc2
this.pc3=pc3
this.edad -= this.edad+1
}
}
this.edad++
this.estado=this.verEstado()
}
}
Comentarios
Publicar un comentario