Sechs Kursabende à vier Stunden an der EB Zürich
Kurskonzeption und Leitung Hanna Züllig
/* Autorin: Marie Louise Illier Kurs: Einblick in die generative Gestaltung mit processing ip971231 Kursleitung: Hanna Zuellig Veroeffentlicht unter der creative common license Attribution-NonCommercial-ShareAlike CC BY-NC-SA http://creativecommons.org/licenses/ */ void setup() { size(500 , 500); noStroke(); rectMode(CENTER); // noLoop(); // Run once and stop } void draw() { background(0); float maxDistance; float distance; int spacer; spacer = 25; float[][] distances; distances = new float[width][height]; maxDistance = dist(0, 0, width, height); //zwischen 0-Punkt und unten rechts = Diagonale for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { //Distanz zwischen Mausposition und x,y berechnen if (mouseX == 0 && mouseY == 0){ distance = dist(x, y, width/2, height/2); } else { distance = dist(x, y, mouseX, mouseY); } //Distanz in Helligkeit umsetzen und in array speichern float dist_norm = norm(distance,0.0,maxDistance); float dist_exp = pow(dist_norm,0.5); distances[x][y] = map(dist_exp,0,1,255,0); //je kleiner, desto heller } } for (int y = 0; y < height; y += spacer) { //Formen im Abstand spacer zeichnen for (int x = 0; x < width; x += spacer) { //Helligkeit aus array lesen fill(#FFFF00 ,distances[x+spacer/2][y+spacer/2]); // rect(x + spacer/2, y + spacer/2,spacer*0.99,spacer*0.99); ellipse(x + spacer/2, y + spacer/2,spacer*0.999,spacer*0.999); } } }