############################################################################ # # File: cycle.icn # # Subject: Program to demonstrate color cycling # # Author: Ralph E. Griswold # # Date: January 8, 1999 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # AD HOC # ############################################################################ # # Requires: Version 9 graphics with mutable colors # ############################################################################ # # Links: graphics # ############################################################################ link graphics $define Palette "c1" procedure main() local color, colors, mutants, alpha, theta, i, chars WOpen("size=400,400", "bg=black") | stop("*** cannot open window") colors := [] mutants := [] chars := PaletteChars(Palette) -- PaletteGrays(Palette) chars := PaletteChars(Palette) every put(colors, color := PaletteColor("c1", !chars)) do put(mutants, NewColor(color)) | stop("*** cannot get mutable color") alpha := 2 * &pi / *colors theta := 0.0 every 1 to * colors do { put(mutants, color := get(mutants)) Fg(color) FillCircle(200, 200, 200, theta, alpha) theta +:= alpha } until WQuit() do { put(colors, color := get(colors)) every i := 1 to *colors do Color(mutants[i], colors[i]) WDelay(10) } end