mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Examples updates for 2.0
This commit is contained in:
@@ -2,26 +2,23 @@
|
||||
* Embedding Iteration.
|
||||
*
|
||||
* Embedding "for" structures allows repetition in two dimensions.
|
||||
*
|
||||
*/
|
||||
|
||||
float box_size = 11;
|
||||
float box_space = 12;
|
||||
int margin = 7;
|
||||
|
||||
size(200, 200);
|
||||
|
||||
|
||||
size(640, 360);
|
||||
background(0);
|
||||
noStroke();
|
||||
|
||||
// Draw gray boxes
|
||||
|
||||
for (int i = margin; i < height-margin; i += box_space){
|
||||
if(box_size > 0){
|
||||
for(int j = margin; j < width-margin; j+= box_space){
|
||||
fill(255-box_size*10);
|
||||
rect(j, i, box_size, box_size);
|
||||
}
|
||||
box_size = box_size - 0.6;
|
||||
|
||||
int gridSize = 40;
|
||||
|
||||
for (int x = gridSize; x <= width - gridSize; x += gridSize) {
|
||||
for (int y = gridSize; y <= height - gridSize; y += gridSize) {
|
||||
noStroke();
|
||||
fill(255);
|
||||
rect(x-1, y-1, 3, 3);
|
||||
stroke(255, 50);
|
||||
line(x, y, width/2, height/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user