%! % an animated rotating yin-yang fractal % rehmi and don, last touched Sat Jun 25 16:50:25 PDT 1988 % depends on don's animator.ps /flipped false def %/yincolor 0 0 .7 hsbcolor def %/yangcolor 0 0 .1 hsbcolor def %/bgcolor .5 .2 .7 hsbcolor def /yincolor { 1 setgray } def /yangcolor { 0 setgray } def /bgcolor .5 def /step ($1) dup length 0 ne {cvi} {pop 10} ifelse def %/depth ($2) dup length 0 ne {cvi} {pop 4} ifelse def /harmonics [ $2 $3 $4 $5 $6 $7 $8 $9 ] dup length 0 eq { pop [1 1 1 1] } if def /depth harmonics length def /rot 0 def /yum { 0 0 1 90 270 arc 0 -.5 .5 270 90 arcn 0 .5 .5 270 90 arc closepath fill } def /yinyang { gsave flipped {yangcolor} {yincolor} ifelse yum 180 rotate flipped {yincolor} {yangcolor} ifelse yum grestore } def /recur { dup 1 ge { gsave harmonics length 1 index sub harmonics exch get rot mul rotate 1 sub yinyang gsave .25 .25 scale 0 3 translate recur 0 -2 translate 180 rotate %-1 -1 scale recur 0 2 translate recur 0 2 translate 180 rotate %-1 -1 scale recur grestore 1 add grestore } if pause } def /yinyangproc { /win framebuffer /new Animator send def /reshapefromuser win send /map win send 0 step 359 { pause /new-page win send setcanvas bgcolor fillcanvas clippath pathbbox scale pop pop .5 .5 scale 1 1 translate /rot exch def depth recur /update-last-page win send } for } fork def