Try   HackMD

Sesc Av. Paulista - Linguagens de programação: Por onde eu começo? Processing

hackmd.io/@villares/sesc-processing (esta página)

Para instalar e experimentar em casa

Referencias artísticas de desenho com programação

Material de referência sobre Procesing

Exemplos

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

size(400, 400); // Tamanho da área de desenho
background(150, 150, 200); //fundo (vermelho, verde, azul)
fill(120, 100, 100, 130);  // cor de preenchimento
rect(30, 40, 100, 150); // x, y, w, h
triangle(100, 100, 300, 100, 200, 300);

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

void setup() {
  size(400, 400);
}

void draw() {
  float sorteio = random(50, 250); 
  //background(150, 150, 200); // vermelho, verde, azul
  fill(120, 100, sorteio);
  rect(mouseX, mouseY, sorteio, 150); // x, y, w, h
  //triangle(100, 100, 300, 100, 200, 300);
}

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


void setup() {
  size(800, 800);
  background(250, 250, 220);
}

void draw() {
  float vermelho = random(128, 256);
  float verde = random(128, 256);
  float azul = 128;
  fill(vermelho, verde, azul);
  noStroke();
  if (mousePressed) {
    circle(mouseX, mouseY, random(20, 90));
    //circle(mouseX, mouseY, 20);
  }
}

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Precisa baixar a fonte Tomorrow e copiar na pasta data dentro do seu projeto.

void setup() {
  size(800, 800);
  background(250, 250, 220);
  PFont f = createFont("Tomorrow-Bold.ttf", 80);
  textFont(f);
  textSize(80);
}

void draw() {
  float vermelho = random(128, 256);
  float verde = random(128, 256);
  float azul = 128;
  fill(vermelho, verde, azul);
  noStroke();
  if (mousePressed) {
    float tam = random(-50, 50);
    text("fim de semana", mouseX, mouseY);
    
    //triangle(mouseX, mouseY, 
    //         mouseX + 50, mouseY, 
    //         mouseX + tam , mouseY + 50
    //        );
  }
}

void keyPressed() {
 if (key == ' ') {
     background(250, 250, 220);
 } else if (key == 's') {
    saveFrame("####.png"); 
 }
}

Recriando "schotter"

int cols = 10; int rows = 15; int tam = 50; int margem = 50; void setup() { size(600, 900); rectMode(CENTER); noLoop(); noFill(); } void cascalho(float x, float y, float w, float h, float rot) { pushMatrix(); translate(x, y); rotate(rot); rect(0, 0, w, h); popMatrix(); } void draw() { background(240); int counter = 0; for (int j = 0; j < rows; j++) { for (int i = 0; i < cols; i++) { float varia = counter / 5; float oy = random(-varia, varia); float ox = random(-varia, varia); float y = margem + tam * j + tam / 2 + oy; float x = margem + tam * i + tam / 2 + ox; float angulo = radians(random(-varia, varia)); cascalho(x, y, tam, tam, angulo); counter++; } } } void keyPressed(){ redraw(); }

exemplo árvore recursiva

float ang = 15; float encurtar = 0.90; int ra = 3; int en = 5; int seed = 1; void setup() { size(900, 900); stroke(0, 100); //noLoop(); } void galho(float tam){ strokeWeight(tam / 10); line(0, 0, 0, -tam); if (tam > 20){ // && random(10) < 9) { pushMatrix(); translate(0, -tam); float a1 = ang + random(-ra, ra); rotate(radians(a1)); galho(tam * encurtar - random(en)); rotate(radians(-a1)); float a2 = ang + random(-ra, ra); rotate(radians(-a2)); galho(tam * encurtar - random(en)); popMatrix(); } } void draw() { ang = frameCount / 30.0; println(ang); randomSeed(seed); background(240); translate(width / 2, height * 0.85); galho(80); saveFrame("####.png"); } void keyPressed(){ seed++; println(seed); }