Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created January 11, 2011 13:54
Show Gist options
  • Save Leonidas-from-XIV/774429 to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/774429 to your computer and use it in GitHub Desktop.
Animations in PostScript, each frage on own page
%!PS-Adobe-3.0
%%BoundingBox 80 210 510 590
%%Title: (The Laughing Man logo)
%%Creator: (Marek Kubica <[email protected]>)
%%EndComments
% blue
/Fgcolor { [ 0 75 115 ] { 255 div } forall } def
% white
/Bgcolor { 1 1 1 } def
% code from PostScript language tutorial and cookbook, 1985
% page 167-170
/outsidecircletext
{
circtextdict begin
/radius exch def
/centerangle exch def
/ptsize exch def
/str exch def
/xradius radius ptsize 4 div add def
gsave
centerangle str findhalfangle add rotate
str
{
/charcode exch def
( ) dup 0 charcode put outsideplacechar
} forall
grestore
end
} def
/circtextdict 16 dict def
circtextdict begin
/findhalfangle
{
stringwidth pop 2 div
2 xradius mul pi mul div 360 mul
} def
/outsideplacechar
{
/char exch def
/halfangle char findhalfangle def
gsave
halfangle neg rotate
radius 0 translate
-90 rotate
char stringwidth pop 2 div neg 0 moveto
char show
grestore
halfangle 2 mul neg rotate
} def
/pi 3.1415923 def
end
% end of the code from the blue book
% (angle -- )
/angletext
{
/fontsize 28 def
/Helvetica-Bold findfont fontsize scalefont setfont
% the text to display
(I thought what I'd do was, I'd pretend I was one of those deaf-mutes)
fontsize
% roll the angle to the top
3 -1 roll
% the radius of the circle
140
% draw it
outsidecircletext
} def
% (radius line-width -- )
/filledcircle
{
/width exch def
/radius exch def
newpath
0 0 radius 0 360 arc
0 0 radius width sub 0 360 arc
eofill
} def
% ( -- )
/innercircle
{
/radius 120 def
0 0 radius 10 170 arc
310 0 rlineto
200 -5 26 90 270 arcn
-93 0 rlineto
0 0 radius 345 180 arcn
stroke
} def
% ( -- )
/smile
{
/radius 80 def
/offset 22 def
0 0 radius 180 offset add 360 offset sub arc
closepath
stroke
} def
% ( -- )
/smileeye
{
/startx 0 def
/starty 0 def
/endx 30 def
/endy 0 def
/midx startx endx add 2 div def
0 0 moveto
startx starty midx 30 endx endy curveto
endx endy midx 15 startx starty curveto
closepath
fill
} def
% ( -- )
/block
{
0 126 moveto
0 10 rlineto
stroke
} def
% ( -- )
/whiteout
{
gsave
Bgcolor setrgbcolor
110 -25 100 40 rectfill
grestore
} def
% ( angle -- )
/angleman
{
Fgcolor setrgbcolor
% consumes the angle parameter
angletext
180 11 filledcircle
whiteout
gsave
20 setlinewidth
innercircle
block
smile
grestore
gsave
-60 -13 translate
1.5 1.5 scale
smileeye
50 0 translate
smileeye
grestore
} def
/laughingman
{
270 400 translate
0 0 moveto
315 angleman
} def
/rotatingman
{
[ 360 -1 1 { 315 add 360 mod } for ]
{
270 400 translate
0 0 moveto
angleman
showpage
} forall
} def
%laughingman
rotatingman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment