home *** CD-ROM | disk | FTP | other *** search
- % $Source: /usr/jm/source/ps/RCS/hop.ps,v $
- % Copyright (c) 1991 by Jeffrey A. Marshall
- % $Revision: 1.6 $
- % $Date: 91/10/06 03:27:16 $
- %
- % hop.ps - real plan fractal movie for Scene
- % This is a translated version of hopalong.c included
- % with the source code to xlock (X11 terminal locker) by
- % Patrick Naughton and Sun Microsystems, Inc.
- %
- % Permission to Use and Abuse as desired, except for commercial purposes.
- % No warranty of any kind.
- %
- % Comments, Additions and Gripes are welcome:
- % jm@baks.bell-atl.com
- % 76060,2302 - compuserve
- % Jeffrey A. Marshall
- % 4 Bates Road
- % Morgantown, WV 26505
-
- % parameters
- /timeout 30.0 def % # of seconds between hops
- /batch_count 100 def % # of points done at once
- /step 1 256 div def % 256 <-> number of colors
- /width 1120 def % width of window
- /height 832 def % height of window
-
- /currentTime { % - currentTime -> seconds_mod_10000
- currentrusage
- pop pop pop pop pop pop pop cvi
- } def
-
- /initHop { % initialize variables for a hop
- % bool initHop -> -
-
- { currentTime srand % has to be a better way
- /centerx width 2 div cvi def
- /centery height 2 div cvi def
- } if
-
- /range centerx centerx mul % centerx * centerx
- centery centery mul % centery * centery
- add sqrt 10 % tmp 10.0
- rand 10 mod % tmp 10.0 (random() % 10)
- add div def
-
- /pix 1.0 def % current `color'
- /inc rand 2147483647 div 400 mul 200 sub cvi def
- /a rand 2147483647 div range mul range 2 div sub cvi def
- /b rand 2147483647 div range mul range 2 div sub cvi def
- /c rand 2147483647 div range mul range 2 div sub cvi def
-
- rand 2 mod 0 eq { /c 0 def } if
-
- /i 0 def
- /j 0 def
-
- 0 setgray
- 0 0 width height rectfill
- /timeNow currentTime def
- } bind def
-
- /hopDisplay { % do a round of hop'n
- % - hopDisplay -> %
- /inc inc 1 add def
-
- 1.0 pix sub pix 1 sethsbcolor % (1.0 - pix) pix 1 sethsbcolor
- /pix pix step sub def % increment `color'
- pix 0 le { /pix 1.0 def } if
-
- newpath % want this inside of loop, if batch_count is very large
- batch_count {
- /oldj j def
- /j a i sub def
- /tmp i inc add b mul c sub abs sqrt def
- /i oldj tmp i 0 le { add } { sub } ifelse def
- centerx i j add add cvi
- centery i j sub sub cvi
- % newpath
- moveto currentpoint lineto % putpixel
- % stroke
- } repeat
- stroke % look up
- } bind def
-
- % an evil window
- /deskWin666 0 0 width height Nonretained window def
-
- deskWin666 windowdeviceround
- 200 currentwindow setwindowlevel
- Above 0 currentwindow orderwindow
-
- % an evil loop
- true initHop
- {
- buttondown { exit } if
- hopDisplay
- currentTime timeNow sub timeout ge { false initHop } if
- } loop { buttondown not { exit } if } loop
-
- Out 0 deskWin666 orderwindow
- deskWin666 termwindow
-
-
- %% Local Variables:
- %% compile-command: "pft -s -f /usr/jm/source/ps/hop.ps"
- %% End:
-