Created
December 10, 2024 17:49
-
-
Save nst/3c2d5b57aaed892c26873550c90980a2 to your computer and use it in GitHub Desktop.
Animated PostScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
%%BoundingBox: 0 0 320 240 | |
% gv -infoSilent anim.ps | |
/Courier findfont 12 scalefont setfont | |
/sleep { 100000 mul {} repeat } def | |
/x 100 def | |
/y 50 def | |
/r 15 def | |
/x_ 2 def | |
/y_ 1 def | |
/f 0 def | |
{ | |
% x bounce | |
x r sub 0 lt x r add 320 gt or { | |
/x_ x_ -1 mul def | |
} if | |
% y bounce | |
y r sub 0 lt y r add 240 gt or { | |
/y_ y_ -1 mul def | |
} if | |
% move circle | |
/x x x_ add def | |
/y y y_ add def | |
% clear page | |
1 setgray | |
0 0 320 240 rectfill | |
% draw circle | |
newpath | |
x y r 0 360 arc | |
1 0 1 setrgbcolor | |
fill | |
10 10 moveto | |
0 setgray | |
(frame ) dup 6 f 10 string cvs putinterval show | |
flushpage | |
10 sleep | |
/f f 1 add def | |
} loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment