############################################################################ # # File: explode.icn # # Subject: Program to use mutable colors for expanding rings # # Author: Ralph E. Griswold # # Date: December 24, 1998 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # AD HOC # ############################################################################ # # Requires: Version 9 graphics and mutable colors # ############################################################################ # Links: graphics # ############################################################################ link wopen $define Size 200 $define Incr 5 procedure main() local colors, radius, n, n_old, numbers, count WOpen("size=" || Size || "," || Size, "canvas=hidden", "bg=black") | stop("*** cannot open window") colors := [] every radius := Size / 2 to 0 by -Incr do { push(colors, n := NewColor("black")) | stop("*** cannot allocated color") Fg(n) FillCircle(Size / 2, Size / 2, radius) WFlush() } WAttrib("canvas=normal") number := *colors count := 0 put(colors, n_old := get(colors)) until WQuit() do { put(colors, n := get(colors)) Color(n, "orange") Color(n_old, "black") n_old := n WDelay(100) count +:= 1 if count < 10 then WriteImage("plosion" || count || ".gif") if count % number = 0 then n every Color(!colors, "black") } end