[comp.sys.next] low-budget screen saver

mdixon@parc.xerox.com (Mike Dixon) (03/19/91)

here's a little postscript hack to give your NeXT machine something
to do while you're not there.  cut between the lines, put it in a file,
and say 'pft -f <full pathname> -s'.
    - a mouse click will stop it
    - it eats a non-negligible fraction of the available cycles; if
      you want those cycles for something else (e.g. if the machine's a
      server) you should probably find something less taxing to keep it
      occupied
    - don't bug me about the ps code; i *said* it was hack

------------------------------------------------------------
/mw 0 currentwindowbounds dup /ht exch def exch dup /wd exch def exch
Nonretained window def
mw windowdeviceround
0 setgray setexposurecolor
25 mw setwindowlevel
Above frontwindow mw orderwindow

/adj { % dx
	rand 40000000 idiv add dup 0 le {-5}{5} ifelse add }
bind def % dx'

/upd { %  dx x max
	yield exch 2 index add 2 copy le  % dx max x' over?
	{ 1 index sub sub exch neg adj neg exch }
	{ exch pop dup 0 lt { neg exch adj exch } if }
	ifelse }
bind def % dx' x'

/xtr { % dxa xa dya ya dxb xb dyb yb ...
	14 index 13 index 12 index 11 index 10 index 9 index 8 index 7 index }
bind def % dxa xa dya ya dxb xb dyb yb ... xa ya xb yb ...

/updl { % dxa xa dya ya dxb xb dyb yb ...
	xtr 24 8 roll
	4 { ht upd 16 2 roll wd upd 16 2 roll } repeat
		% xa ya xb yb ... dxa' xa' dya' ya' dxb' xb' dyb' yb' ...
	1 setgray xtr moveto curveto stroke
	obscurecursor }
bind def

30 100 20 100 -30 500 10 500 -20 700 40 200 20 900 -10 700
updl updl updl updl updl
{ 56 -8 roll 0 setgray moveto curveto stroke updl buttondown {exit} if } loop
------------------------------------------------------------
enjoy...
--

                                             .mike.