Playing with hand-written PostScript

It is fun if you know you can write PostScript by yourself. Especially, it is useful to produce a figure based on a simple calculation. In this page I show some simple figures made from PostScript with sources. For syntax of PostScript please refer other pages.

Sun-light Clock

Please cut the sheet appropriately and put it on your window-side. The shadow of the window edge will tell you the time.

%!PS-Adobe-2.0 %%%%%%%%%%%%%%%% Font /Helvetica findfont 20 scalefont setfont %%%%%%%%%%%%%%%% Center and size 200 420 translate /size 3 def %%%%%%%%%%%%%%%% Hour lines 0 setlinewidth 0 1 23 { dup gsave 12 sub -15 mul rotate newpath 0 0 moveto 121 size mul 0.5 lineto 121 size mul -0.5 lineto closepath fill 121 size mul 0 moveto 90 rotate dup 10 ge {-12} {-6} ifelse % move string more left if hour >= 10 -20 rmoveto 5 string cvs show grestore } for %%%%%%%%%%%%%%%% 30-minute lines 0.6 setlinewidth 0 1 2 div 24 { gsave 12 sub -15 mul rotate newpath 80 size mul 0 moveto 120 size mul 0 lineto stroke grestore } for %%%%%%%%%%%%%%%% 10-minute lines 0.35 setlinewidth 0 1 6 div 24 { gsave 12 sub -15 mul rotate newpath 100 size mul 0 moveto 119 size mul 0 lineto stroke grestore } for %%%%%%%%%%%%%%%% 5-minute lines 0.2 setlinewidth 0 1 12 div 24 { gsave 12 sub -15 mul rotate newpath 110 size mul 0 moveto 118 size mul 0 lineto stroke grestore } for %%%%%%%%%%%%%%%% 1-minute lines 0.1 setlinewidth 0 1 60 div 24 { gsave 12 sub -15 mul rotate newpath 115 size mul 0 moveto 117 size mul 0 lineto stroke grestore } for showpage