Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import controlP5.*;
- int m[][];
- ControlP5 guiH, guiV, guiTQ;
- int quantidadeHorizontal = 0;
- int quantidadeVertical = 0;
- int tamanhoQuadrado = 50;
- void setup() {
- size(500, 500);
- rectMode(CENTER);
- guiH = new ControlP5(this);
- guiH.addSlider("quantidadeHorizontal")
- .setRange(5, 100)
- .setValue(quantidadeHorizontal)
- .setPosition(10, 475)
- .setSize(200, 20);
- guiV = new ControlP5(this);
- guiV.addSlider("quantidadeVertical")
- .setRange(5, 100)
- .setValue(quantidadeVertical)
- .setPosition(10, 450)
- .setSize(200, 20);
- guiTQ = new ControlP5(this);
- guiTQ.addSlider("tamanhoQuadrado")
- .setRange(5, 100)
- .setValue(tamanhoQuadrado)
- .setPosition(10, 425)
- .setSize(200, 20);
- }
- void draw() {
- background(128);
- criaArte(quantidadeHorizontal, quantidadeVertical, tamanhoQuadrado);
- }
- void criaArte(int quantidadeHorizontal, int quantidadeVertical, int tamanhoQuadrado) {
- int[][] matriz = new int[quantidadeHorizontal][quantidadeVertical];
- for (int i = 0; i < quantidadeHorizontal; i++) {
- for (int j = 0; j < quantidadeVertical; j++) {
- bloco(i * tamanhoQuadrado + tamanhoQuadrado/2, j * tamanhoQuadrado + tamanhoQuadrado/2, tamanhoQuadrado);
- }
- }
- }
- void bloco(int x, int y, int l) {
- //fill(random(0, 255), random(0, 255), random(0, 255));
- rect(x, y, l, l);
- circulo(x, y, l/2);
- circulo(x, y, l/3);
- circulo(x, y, l/6);
- }
- void circulo(int x, int y, int r) {
- //fill(random(0, 255), random(0, 255), random(0, 255));
- ellipse(x, y, 2*r, 2*r);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement