> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://codigodelaimagen.sketchpad.cc/sp/pad/view/ro.bx74t9NxbQ7/rev.11
 * 
 * authors: 
 *   emilio gonzález villegas

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// This sketch builds on a prior work, "ejercicio1", created by emilio gonz&#225;lez villegas
// http://codigodelaimagen.sketchpad.cc/sp/pad/view/ro.Bb89gC-sjIUsa/rev.6


// This sketch builds on a prior work, "Untitled Sketch", created by emilio gonz&#225;lez villegas
// http://codigodelaimagen.sketchpad.cc/sp/pad/view/ro.B3$7uteawrWZ8/rev.109


//este ejercicio es para practicar un poco algunos conceptos

int width=500;
int height=500;

  /*hay un problema al exportar de processing a sketchpad con el tamaño de lienzo*/
  
void setup(){
  
  size(500,500);
  smooth();
  frameRate(1);
  background(255);
 //noLoop();
}

void draw(){
  
  background(255);
  
/*int contadorH=0;
  while(contadorH<=width);{
    contadorH=contadorH+5;
    stroke(0);
    ellipse(contadorH,50,50,50);
  }*/
  
  int contador=0;
  int limite=25;
  
  float puntoAnteriorX=0;
  float puntoAnteriorY=0;
  
  
  while(contador<limite){
  strokeWeight(1);
  
  float puntoX=random(width);
  float puntoY=random(height);
  
  float puntoA=random(width)-50;
  float puntoB=random(height)-50;
  
   point(puntoX,puntoY);
   
   stroke(255,0,0);
   
  
   point(puntoA,puntoB);
   
   float d=dist(puntoX,puntoY,puntoAnteriorX,puntoAnteriorY);
  
  if(d<100){
    
    stroke(0,0,0,random(80,100));
    
    triangle(puntoX,puntoY,puntoAnteriorX,puntoAnteriorY,puntoA,puntoB);
    
    strokeWeight(1);
    float radioCircle=random(50);
    noFill();
    ellipse(puntoX,puntoY,radioCircle,radioCircle);
   
    int contadorC=0;
    while(contadorC<=500){
      contadorC=contadorC+15;
      stroke(random(200,255),0,0,random(80,100));
    ellipse(puntoX,puntoY,100+contadorC,100+contadorC);
    stroke(0,0,random(200,255),random(0,80));
    ellipse(puntoX,puntoY,85+contadorC,85+contadorC);
    stroke(0,random(0,100),0,random(0,80));
    ellipse(puntoX,puntoY,70+contadorC,70+contadorC);
    }
    
    int[] coleccion={1,2,3};
    
    PFont fontA = createFont("Times New Roman",24,  true);
    textFont(fontA, 36);
    fill(0);
    textSize(radioCircle);   
    textAlign(CENTER);
      text(coleccion[0],puntoX,puntoY+radioCircle/4);
    text(coleccion[1],puntoAnteriorX,puntoAnteriorY+radioCircle/4);
    text(coleccion[2],puntoA,puntoB+radioCircle/4);
   
    /*
    String mensaje="a";
    textFont(fontA, 36);
    fill(0);
    textSize(radioCircle);   
    textAlign(CENTER);
    text( mensaje, puntoX,puntoY+radioCircle/4);
    */

    if(d<50){
      fill(0,50);
    }else{
      noFill();
    }
    
   
    //line(puntoX,puntoY,puntoAnteriorX,puntoAnteriorY);
  }
  contador=contador+1;
  
  //detrás para iniciar una secuencia de puntos
  
  puntoAnteriorX=puntoX;
  puntoAnteriorY=puntoY;
  
  
}
    
}

void mousePressed(){
noLoop();
}

void keyPressed(){
  loop();
}