juliaGraphics.frink

Download or view juliaGraphics.frink in plain text format

/** This is a very simple demonstration program that shows the basics of
    calculating the Julia set and displaying it as graphics. */


// Pick a complex number for a starting point
C = 0.3 + .1i


// Maximum levels for each pixel.
levels = 60

// Create a random color for each level.
colors = new array[[levels]]
for a = 0 to levels-1
   colors@a = new color[randomFloat[0,1], randomFloat[0,1], randomFloat[0,1]]

// Make this number smaller for higher resolution.
stepsize = .005

g = new graphics
g.antialiased[false]


for im = -1.8 to 1.8 step stepsize
{
   imag = i * im
   for real = -1.8 to 1.8 step stepsize
   {  
      z = real + imag
      count = -1

      do
      {
         z = z^2 + C
         count=count+1;
 az = abs[z]
      } while az < 4 and az > 1e-200 and count < levels

      g.color[colors@((count-1) mod levels)]
      g.fillRectSize[real, im, stepsize, stepsize]
   }
}

g.show[]


Download or view juliaGraphics.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 was born 20107 days, 23 hours, 27 minutes ago.