Wir haben uns an der Hochschule mit Aleatorik (Zufallsgestaltung) beschäftigt. Von Hand bekommt man Zufall nicht so richtig hin, deshalb habe ich mir ein wenig Processing um die Ohren geschlagen und das hier ist dabei herausgekommen. Nicht besonders spektakulär, aber sieht hübsch aus :)
Den Code dazu gibt es hier:
// 2D Array of objects Cell[][] grid; // Number of columns and rows in the grid int cell_width = 40; int width; int height; int cols; int rows; void setup() { colorMode(RGB); width = displayWidth; height = displayHeight; size(width,height); cols = width / cell_width; rows = height / cell_width; grid = new Cell[cols][rows]; for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { // Initialize each object grid[i][j] = new Cell(i*cell_width,j*cell_width,cell_width,cell_width); } } } void draw() { background(255); // The counter variables i and j are also the column and row numbers and // are used as arguments to the constructor for each object in the grid.
Ganzen Artikel lesen