Flash Bestiary / BASICs / Random Checkers |
|
Random CheckersThis adds a few more features to the last movie, and enables you to interact with it a bit. The symmetry, and some other drawing effects can be turned on and off by pressing the buttons. Note: Many of the movies in my collection have buttons or sliders which allow you to control certain features. For any sufficiently complex animation, there may be many features that may be controlled in this manner, but I will usually choose just a few for user-control, in order to keep the interface relatively simple. The code for the buttons and sliders is at the bottom of the script, and can be removed without affecting the rest of the movie. Up till now, I've computed a random color using the following line: var tint = Math.floor(Math.random()*0x1000000); But now, we use the Math.sin() function to cycle thru the values for each color component (r,g and b). The variable saturation, which ranges from 0 to 1, is used to push each color component up to 120 degrees out of phase, which gives us highly saturated colors. When saturation is zero, each color component is the same and we get shades of gray.
var t = getTimer()*.001; Also, I've added add the following code to produce a checkerboard pattern.
if ((x + y) & 1) // Checkboard test |
|
|
|
Next: Pseudo Mondrian |
Copyright © 2003,2008 by Jim Bumgardner. All Rights Reserved. Leave Jim some feedback