Ir al contenido principal

Entradas

Mostrando entradas de septiembre, 2017

Juego

float posX []; float posY []; int matados []; float angulos []; int numrect =500; int puntaje=0; PFont miletrica; //Setup o Configuraciones void setup(){   size(400,400,P3D);   background(255);   noStroke();   posX= new float[numrect];   posY= new float[numrect];   angulos= new float[numrect];   matados= new int[numrect];   for(int i=0; i< numrect; i=i+1){     posX[i]= random(380);     posY[i]= random(30);     matados[i]=0;     angulos[i]=0;   }   //miletrica=loadFont("Univers45.vlw");   //textFont(miletrica, 18); } void draw(){   puntaje=0;   background(255);   for(int i=0; i< numrect; i=i+1){     posY[i]= posY[i] + random(0.01*i);   }   for(int i=0; i<numrect;i=i+1){     if(matados[i] == 0) {       pushMatrix();       translate(posX[i], posY[i]);       r...

Mosquito

ArrayList<PVector> points; float x0, y0, x, y, angle; final float step = 1; final float minDist = step / 6; final float maxDist = 10; void setup() {   size(900, 400);  background(70, random(50, 100), 100);   stroke(255, 255);   smooth();   points = new ArrayList<PVector>();   x0 = random(width);   y0 = 0;   angle = random(TWO_PI); } void draw() {  background(50, random(50, 100), 100);   x = (width + x0 + step * cos(angle)) % width;   y = (height + y0 + step * sin(angle)) % height;   PVector pt = new PVector(x, y);   for (PVector p : points) {     if (pt.dist(p) < minDist) {       pt = points.size() > 500 ? points.get(int(random(300))) : new PVector(random(width), 0);       break;     }   }   for (PVector p : points) {     if (pt.dist(p) < maxDist) {       line(p.x, p.y, pt.x, pt.y); ...

Espiral

ArrayList points; int counter; double step, theta; PVector dummy; void setup(){ frameRate(10);//instruccion para acelerar la ejecucion size(500,500); background(600); stroke(98); fill(168); points = new ArrayList(); dummy = new PVector(0,0); counter=0; theta=0; step = Math.PI/40; } void draw(){   float actx = 0;   float acty = 0;   float h = 300;   float k = 150;   float r = counter;   background(255, 300, 100);//color cambia   actx=h;   acty=h;   //for(float theta=0; theta < 2* Math.PI; theta+=step)   if(theta<9*Math.PI)//controlador de vueltas   { float x = (float)(h+r*Math.cos(theta));   float y = (float)(k - r*Math.sin(theta));   //point(x,y);   pint p = new pint(x,y,counter); points.add(p);   ellipse(x,y,5,10);   counter++;   theta+=step;   trace();   } } void trace(){   for(int i=0; i<points.size()-2;i++){   pi...