header

 

More links

AutoHotkey | Android | Arduino | COMM140Fractals | Grammar Checkers | Knots | A Million Dots Activity |  Processing | Processing for Scratch Users | RedBubble | Tutorials | Weather | World Time Meeting Planner | Favicon Generator.

Home > Tutorials > Processing > Processing Examples > Scintillating Grid

Scintillating Grid

Scintillating Grid

Based on the work of: Schtauf, M., Lingelbach, B., Wrist, E.R. (1997). The scintillating grid illusion. Vision Research, 37, 1033-1038.

code formatter

processing code

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Scintillating Grid 
// Author: Rupert Russell
// October 2, 2010
// Schtauf, M., Lingelbach, B., Wrist, E.R. (1997)
// The scintillating grid illusion. Vision Research,
// 37, 1033-1038.

void setup() {
  size(283, 200);         
  background(0);          // black background
  strokeWeight(3);        // medium weight lines 
  smooth();               // antialias lines
  stroke(100, 100, 100);  // dark grey colour for lines
  noLoop();
}

void draw() {
  int step = 25;          // grid spacing
  
  //vertical lines
  for (int x = step; x < width; x = x + step){
    line(x, 0, x, height); 
  }
  
  //horizontal lines
  for (int y = step; y < height; y = y + step){
    line(0, y, width, y);
  }
  
  // Circles
  smooth();
  ellipseMode(CENTER);
  stroke(255);  // white circles
  for (int i = step; i < width -5; i = i + step) {
    for (int j = step; j < height -15; j = j + step) {
      strokeWeight(6); 
      point(i, j);
    }
  }
}

// Save tif when mouse is clicked
void mouseClicked(){   
  noLoop();
  save("scintillating.png");
}
code formatter

 

 


APA citation:
Russell, R. (2018, June 28, 11:48 am). Scintillating grid.
     Retrieved April 25, 2024, from http://www.rupert.id.au/tutorials/processing/examples/scintillating.php

Last refreshed: April 25 2024. 04:03.06 pm

rupert dot russell at acu dot edu dot au Support Wikipedia

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.


753 visits since October 02, 2010