martes, 12 de diciembre de 2017

Cuadrado Que Gira

float r = 0;
float backR;
float backG;
float backB;

void setup() {
  size(400,400);
  backR = random(0,100);
  backG = random(0,100);
  backB = random(0,100);

  background(random(2),random(2),random(2));
  rectMode(CENTER);

  noStroke();
  smooth();
}

void draw() {
  fill(backR, backG, 50, 50);

  rect(width/2, height/2, width, height);

  fill(255);
  translate(mouseX, mouseY);
  rotate(r);
  rect(0, 0, 100, 100);

  r = r + 1.5;
}

Líneas Random

void setup() {
  size(600,600);
  background(30,30,200);
}
void draw() {
  fill(0);
  stroke(random(255),random(255),random(255));
  line(0,600,mouseX,mouseY);
  line(0,0,mouseX,mouseY);
  line(600,0,mouseX,mouseY);
  line(600,600,mouseX,mouseY);
}

martes, 5 de diciembre de 2017

Cuadrado con líneas

size(200,200);
background(12,150,100);

stroke(300,0,0);
line(20,20,20,180);

stroke(0,300,0);
line(20,180,180,180);

stroke(300,0,300);
line(180,180,180,20);

stroke(300,300,0);
line(20,20,180,20);