onsdag, april 12, 2006

bun = a sin (5.3 hair)



/Helvetica findfont
90 scalefont
setfont
1 setlinewidth
/a 50 def

0 2 360 {
    newpath
    gsave
        /k exch def
        /r a 5.3 k mul sin mul def
        200 r k cos mul add
        200 r k sin mul add
        moveto
        k rotate
        -15 -23 rmoveto
        (hair) true charpath
        gsave
            .9 .9 0 setrgbcolor
            fill
        grestore
        0 0 0 setrgbcolor
        stroke
    grestore
} for

3 kommentarer:

Anonym sa...
Den här kommentaren har tagits bort av bloggadministratören.
Anonym sa...

Marko
.....these are cool --
remind me of escher --
also,
interesting scripts --
what is the language??

marko sa...

Thanks, Ted. The language here is PostScript; I write the code in Notepad, save it with .ps extension, and then convert it to PDF using Acrobat Distiller. The syntax of PostScript is pretty weird and very different from all the other languages I've ever used. Everything seems to be upside down; for instance the line

/r a 5.3 k mul sin mul def

would be something like

r = a * Math.sin(5.3 * k);

in JavaScript. These are my very first PostScript pieces, and there's still much to learn, but it seems quite a capable language indeed.