%!PS-Adobe-2.0 %%BoundingBox: 0 0 612 792 %%Pages: 1 %%EndComments %%Page: 1 1 % tewi0.ps - Don Yang (uguu.org) % % 11/16/08 % Seed random number generator. systemdict /Seed known { Seed } { usertime } ifelse srand 9 { rand pop } repeat % Page settings /Margin 54 def /Width 504 def /Height 684 def /HalfDiagonal Width dup mul Height dup mul add sqrt 2 div def /PageScale Width Height lt {Width} {Height} ifelse def /SpriteSpacing 18 def /SpriteScale 0.2 def % Generate random number between 0 and 1 /Rand { rand 2 31 exp div } bind def % Initialize colors /Hue Rand def % Initialize parameters /StepCount 8 def /TPhase Rand 360 mul def /TPeriod Rand 240 mul 120 add PageScale div def % Draw a single sprite at origin /Dan { % Bottom layer -50 0 moveto -33 16 -23 25 0 25 curveto 23 25 33 16 50 0 curveto 33 -16 23 -25 0 -25 curveto -23 -25 -33 -16 -50 0 curveto clip newpath Hue 1.0 0.4 sethsbcolor -60 60 moveto 60 60 lineto 60 -60 lineto -60 -60 lineto closepath fill % Gradient 1 1 StepCount { StepCount div Hue 1.0 2 index 0.4 mul 0.4 add sethsbcolor 80 mul -60 add 50 moveto 40 -100 rlineto 100 0 rlineto 0 100 rlineto closepath fill } for % Top layer 0.0 0.0 1.0 sethsbcolor false { % Full shape -33 0 moveto -25 10 -16 15 0 15 curveto 16 15 25 10 33 0 curveto 25 -10 16 -15 0 -15 curveto -16 -15 -25 -10 -33 0 curveto fill } { % Half shape -33 0 moveto -25 10 -16 15 0 15 curveto 16 15 25 10 33 0 curveto closepath fill } ifelse } bind def % Draw circular set of sprites /TLoop { % r, a /a exch def /r exch def % Start angle 0 % Get angular step, round up so that it evenly divides into the circle 360 360 SpriteSpacing r atan div ceiling div 360 { % i += 30 * sin(r * TPeriod + TPhase) r TPeriod mul TPhase add sin 30 mul add /i exch def gsave % x = cos(i) * r + Margin + Width / 2 i cos r mul Margin add Width 2 div add % x, y = sin(i) * r + Margin + Height / 2 i sin r mul Margin add Height 2 div add % Draw sprite translate a i add rotate SpriteScale SpriteScale scale Dan grestore } for } bind def % Draw a series of sprites laid in concentric circles /RLoop { % Inner radius SpriteSpacing % Step SpriteSpacing % Outer radius HalfDiagonal { % Rotate angle dup TPeriod mul TPhase add cos 60 mul TLoop } for } bind def % Clip at page margins Margin Margin moveto Width 0 rlineto 0 Height rlineto Width neg 0 rlineto closepath clip newpath % Draw sprites RLoop showpage %%EOF