spe@spice.cs.cmu.edu (Sean Engelson) (07/13/88)
% This program changes the root image to a Yin/Yang symbol on a purplish
% background. It also, if you want, will set the symbol to spin
% around its centre. Quite pretty.
% Created by Sean P. Engelson
% Spinning thought of by John Kolojejchick
systemdict begin
% Draw a yin/yang (just some arcs and fills)
/yinyang { % angle x y => __
translate
40 40 scale
10 10 translate rotate -10 -10 translate
1 setgray
newpath
10 10 10 0 180 arcn
5 10 5 180 0 arc
15 10 5 180 0 arcn
fill
0 setgray
newpath
10 10 10 0 180 arc % big arc black side
5 10 5 180 0 arc % black bulge
15 10 5 180 0 arcn % white bulge
fill
gsave
4 10 moveto
newpath
5 10 1 0 360 arc
1 setgray fill
grestore
newpath
10 10 10 0 360 arc
stroke
newpath
14 10 moveto
newpath
15 10 1 0 360 arc
0 setgray fill
} def
% angle to draw it at
/YinYangAng 0 def
% Draw it on the root
/RootYinYang {
gsave
framebuffer setcanvas
0 0 1200 1200 rectpath
.5 .5 1 setrgbcolor fill
YinYangAng 160 60 yinyang
grestore
} def
/PaintRoot /RootYinYang load store PaintRoot
end
% Set the yin/yang to spin by queuing events.
/TimeYinYang {
{
/d 2 dict dup begin
/RotateYinYang {
/YinYangAng YinYangAng 5 add store % change the 5 to adjust
% the speed
gsave
framebuffer setcanvas
YinYangAng 160 60 yinyang
grestore
SendNewYinYangEvent
} def
end def
/e1 createevent def
e1 /Name d put
e1 expressinterest
/SendNewYinYangEvent {
e1 createevent copy dup begin
/Name /RotateYinYang def
/TimeStamp currenttime .05 add def
end
sendevent
} def
SendNewYinYangEvent
{ awaitevent } loop
} fork
} def
% If you don't want it to spin, comment this next line:
TimeYinYang