Skip to content

Instantly share code, notes, and snippets.

@pLabarta
Created March 20, 2021 11:37
Show Gist options
  • Save pLabarta/52b6875f2a4be190d1f93d8c49483f31 to your computer and use it in GitHub Desktop.
Save pLabarta/52b6875f2a4be190d1f93d8c49483f31 to your computer and use it in GitHub Desktop.
Actividades Processing Clase 1
void setup() {
//background(225, 210, 70);
size(900,900);
frameRate(24);
}
float[] pos_x = {-12,-8.0,0,8.0,12,8.0,0,-8.0};
float[] pos_y = {0,-8.0,-12,-8.0,0,8.0,12,8.0};
int red = 0;
int i = 0;
int[] grid_x = {1,2,3,4,5,6,7,8,9};
int[] grid_y = {1,2,3,4,5,6,7,8,9};
int grid_size = 90;
void draw() {
if (i<81) {
if ((i%81)==0) {
background(230,230,40);
}
//noFill();
stroke(0);
//strokeWeight(0);
fill(0 * grid_y[(i%81)/9] * (0.2 * grid_x[i%9]) ,0,0);
rectMode(CENTER);
int position_x = grid_size * grid_x[i%9];
int position_y = grid_size * grid_y[(i%81)/9];
rect(position_x + pos_x[i%8],position_y + pos_y[i%8],70,70);
i = i + 1;
//fill(30 * grid_y[(i%81)/9], 20 + 20 * grid_x[i%9] , 30 * grid_y[(i%81)/9]);
fill(255,255,255);
ellipse(position_x,position_y,30,30);
}
};
int max_size = 950;
void setup() {
size(1000,1000);
}
int start_y = 25;
int start_x = 25;
int chico = 150;
int grande = 300;
int resto = max_size - grande - chico;
void draw() {
//Cuadrado contenedor
stroke(0);
strokeWeight(max_size/35);
rectMode(CORNER);
fill(233, 231, 232);
rect(start_x,start_y,max_size,max_size);
// Rectangulo amarillo
fill(255, 221, 10);
rect(start_x,start_y,grande,resto);
// Rectangulo rojo
fill(225, 13, 30);
rect(start_x+grande,start_y,resto+chico,max_size-chico);
// Rectangulo azul
fill(8,56,138);
rect(start_x,start_y+resto+grande,grande,chico);
// Resto de abajo
fill(233, 231, 232);
rect(start_x+grande,start_y+resto+grande,resto,chico);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment