summaryrefslogtreecommitdiff
path: root/ipl/gprogs/splat.icn
blob: 1c85f0c87fde5144391d47c0eee7cc83cb7b3741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
############################################################################
#
#	File:     splat.icn
#
#	Subject:  Program to drop paint splatters in a window
#
#	Author:   Gregg M. Townsend
#
#	Date:     September 30, 1995
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  usage: splat [nspots [diameter]]
#
#     splat draws random circular spots in a window.  The number of spots
#  and maximum diameter can be passed as command options.
#
############################################################################
#
#  Requires:  Version 9 graphics
#
############################################################################
#
#  Links: graphics, random
#
############################################################################

link graphics
link random

procedure main(args)
   local w, h, n, m, d

   Window("size=800,500", args)
   w := WAttrib("width")
   h := WAttrib("height")
   n := integer(args[1]) | 1000
   m := integer(args[2]) | 100

   randomize()
   every 1 to n do {
      Shade(RandomColor())
      d := (?m * ?m * ?m) / (m * m)
      FillArc(?(w - d - 1), ?(h - d - 1), d, d)
      }
   WDone()
end