boxIllusion2.frink

Download or view boxIllusion2.frink in plain text format

/** Generates an optical illusion.  The horizontal lines are straight,
    but they don't appear to be!
*/

g = new graphics

height = 1000
width = 700

y = 0

f[y] := 2000./(abs[y-(height/2)])
size = 0

do
{
   size = randomFloat[min[f[y], f[y+size]], min[f[y]-3, f[y+size]+4]] + 10
   println[size]
   x = 0
   g.color[2/3,2/3, 2/3]
   g.line[0,y,width,y]
   do
   {
      g.color[0, 0, 0]
      g.fillRectSize[x,y,size,size]
      x = x + 2 size
   } while x < width
   y = y + size
} while y < height

g.show[]

println[inputForm[getFunction["f",1]]]


Download or view boxIllusion2.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com