Question about box() and movement
in
Programming Questions
•
1 year ago
Hello,
I wrote a sketch which draw a box consist of boxes, here is my code (do not pay attention to comments in russian)
- import processing.opengl.*;
- int boxSize = 40; //размер кубика
- int boxCount = 10; //Кол-во кубиков на сторону
- int[] k = {0,0,1,2,3,4,5,6,7,8,9}; //хитрые коэф для ебаного транслэйта
- int wndW = 800; //Ширина окошка
- int wndH = 800; //Высота окошка
- void setup()
- {
- size(wndW, wndH,OPENGL);
- background(0);
- smooth();
- frameRate(10);
- noFill();
- stroke(255);
- // noStroke();
- }
- void draw()
- {
- background(0);
- translate (wndW/2-boxSize*boxCount/2,wndH/2-boxSize*boxCount/2,0); //Центруе кубик в окне
- for (int x=0;x<boxCount;x=x+1)
- {
- translate(x*boxSize-k[x]*boxSize,0,0);
- for (int y=0;y<boxCount;y=y+1)
- {
- translate(0,y*boxSize-k[y]*boxSize,0);
- box(boxSize);
- }
- translate(0,-1*(boxSize*boxCount-boxSize),0);
- }
- //boxSize=boxSize+1;
- }
1