Circular Gradient Pattern Generator v2.0 Readme File


Written by Jeff Lewis, making heavy use of Brightness Demo 2005 by Tanner "DemonSpectre" Helland. I downloaded the sample code to display raster graphics from I kept parts of that program, added my own relatively simple methods of generating gradients, and made some related changes to the form to make it work for this application.

Basically, the program creates circular gradients about points, and overlays all these gradients to generate the patterns. There are two methods of gradients - a simple linear method, which generates fairly smooth gradients, and a power based method, which generates sharper gradients. There is also a method for creating animations of these gradients.

For an example of the types of images and animations made with this program, see the following page on my website:

Draw Set of 3

The "Draw Set of 3" buttons under "Powers:" and "Linear:" are similar. Each one generates a red gradient, a green gradient, and a blue gradient. The gradients are controlled directly by the numbers in the text boxes below the buttons.

Draw Combined Pattern

The "Draw Combined Pattern" buttons each generate a random collection of circle gradients to be drawn, one using the Power method, the other the linear method. The collection of points is then outputted to "Input:" textbox. Then, the subroutine, DrawCirclesFromText, is called. It reads in the data from the textbox, and draws the appropriate gradient pattern. That way, you can manually manipulate the input if you want to change pattern. After the pattern is generated, it is saved to a bitmap file, using the "Path," "Series," and "Frame" parameters specified in the appropriate text boxes.

Draw From Text

This calls the subroutine, DrawCirclesFromText, to read in the data from the "Input:" textbox, and then generate the gradient patterns. It then saves the pattern to a bitmap file, using the "Path," "Series," and "Frame" parameters specified in the appropriate text boxes. This allows you to manually manipulate the pattern as much as you want.

Generate Animation

This calls the subroutine, GenerateAnimation, in the module, ModuleAnimation. Currently, the animation uses only the linear method. It moves the points in a circular motion, and varies the scalar and magnitude variables as a cosine function. For each frame, it outputs the appropriate variables to the "Input:" textbox, then calls the subroutine, DrawCirclesFromText, saving the frames as described above.

There is a section in that subroutine, under the commented heading, "Set Animation Variables," that looks like this:

  'Call GenerateRandomAnimationPoints
  Call GenerateManualAnimationPoints

This allows the user to easily generate the animation randomly or by using a pre- programmed animation by simply switching which line is commented out.

The subroutine, GenerateRandomAnimationPoints, will output a text file with the suffix, "-Code.txt" to the same directory as where the frames are being saved. If this code is copied and pasted into the subroutine, GenerateManualAnimationPoints, it will create the exact same animation as just created randomly.

Also under the commented heading, "Set Animation Variables," there is a line that looks something like this:

  NumberFrames = 60

The animation will always cycle through one loop, such that the last frame is almost the same as the first frame. This NumberFrames variable controls how smooth the animation is. Obviously, the higher the number of frames, the smoother the animation. What I found to be a decent compromise was to set that number as something low like 10 or 15 when doing the random animations. Then, once I'd found an animation that I liked, I'd copy and paste the text from the "-Code.txt" file into the subroutine, GenerateManualAnimationPoints, and up the NumberFrames to 60 to create a better animation of that motion.

To actually generate an animation file from the bitmaps, you'll need to use your own animation program. I've been using Adobe ImageReady 3.0 (came bundled with PhotoShop 6.0) and found it to work pretty well. I also did a test case with Windows Movie Maker. It worked tolerably well, but was tedious, and didn't allow the images to be displayed for a short enough time to make the animation as quick as I wanted.