home *** CD-ROM | disk | FTP | other *** search
- %% jitterbug.ps
- %%
- %% Written April 29, 1990,
- %% Scott Hess
- %% NeXT Campus Consultant
- %% Gustavus Adolphus College
- %% St. Peter, Mn 56082
- %% scott@gacvax1.bitnet
- %%
- %% This program is heavily based on melt.ps. It doesn't melt the screen
- %% though, it just makes it jump around.
-
- %% This file may be installed so that the Scene application will bring it up
- %% under the Movies menu. To do this, create a directory within the
- %% /NextLibrary/Images/Scene_movies directory named jitterbug.movie. Inside this
- %% directory, place this file, with the name jitterbug.script.ps. Then, run
- %% Scene, and there you are. This really belongs in the /LocalLibrary
- %% directory, but unfortunately, Scene will not find it there. Sad, eh?
-
- %% This code is freely released into the public domain. You may cut/paste,
- %% slash, rearrange, remove comments, and otherwise mutilate this code
- %% with no fear of reprisal from myself. So, go ahead! I want to see more
- %% screen hacks, people!
-
- %% scott
-
- %% Grab the Workspace and draw it in the passed window.
- /getWorkspace % window
- {
- gstate /dest exch def
- /tempwin 0 0 1120 832 Nonretained window def
- tempwin windowdeviceround
- /tgs gstate def
-
- false tempwin setautofill
- Above 0 currentwindow orderwindow
-
- dest setgstate 0 0 1120 832 tgs 0 0 Copy composite
- tempwin termwindow
- } def
-
- %% Move a region of the current gstate.
- /shift %% x y w h dx dy
- {
- 4 index add
- exch 5 index add
- exch
- gstate
- 3 1 roll
- Copy composite
- } def
-
- %% Return after mouseclick accepted.
- /waitmouse
- {
- { buttondown {exit} if} loop
- { stilldown not {exit} if} loop
- } def
-
- %% return a random number between the 0 and the integer passed -1.
- %% (ie, 100 rand returns from the range 0..99).
- /random
- {
- rand exch mod
- } def
-
- gsave
- %% get a window the size of the Workspace.
- /win 0 0 1120 832 Buffered window def
- win windowdeviceround
-
- currentwindow getWorkspace
-
- %% Move the psuedo-Workspace to the front.
- Above 0 win orderwindow
-
- %% How fast to drop. Not really needed, now.
- /moveby 3 def
-
- 0.0 setgray %% leave behind Black
- {
- /width 1100 random 20 add def %% get a width from 20..1119
- /height 812 random 20 add def %% and a width from 20..831.
- /x 1120 width add random width sub def
- x 0 lt { width x add /x 0 def} if %% constrain x to screen.
- /y 832 height add random height sub def
- y 0 lt { height y add /y 0 def} if %% constrain y to screen.
- /dx moveby random moveby 3 div sub def %% how much to move?
- /dy moveby random moveby 3 div sub def
- x y width height dx dy shift %% move it.
- flushgraphics
- buttondown {exit} if %% get out of here if buttondown
- }
- loop
- waitmouse %% wait for that buttondown.
-
- win termwindow %% get rid of the window.
- grestore
-
-