y - radius * cos(phi + rho)
                )
            )
    else:
        for i in range(n - 1, 0, -1):
            rho = 2 * pi * i / n
            pen.lineTo(
                (
                    x - radius * sin(phi + rho),
                    y - radius * cos(phi + rho)
                )
            )
    
    # Close the path
    pen.closePath()


g = CurrentGlyph()
g.clear()
p = g.getPen()

diameter = 600
n = 8

for i in range(10):
    clockwise = i % 2
    phi = 1.2 * i * pi
    draw_polygon(p, (275, 216), diameter, n, phi, clockwise)
    #n -= 1
    diameter -= 50
Exemplo n.º 2
0
# robofab manual
# Pen object
# usage examples

from robofab.world import CurrentGlyph

newGlyph = CurrentGlyph()

pen = newGlyph.getPen()

# do stuff with the pen to draw in this glyph
Exemplo n.º 3
0
# robothon06
# get a pen and draw something in the current glyph
# what will it draw? ha! run the script and find out!

from robofab.world import CurrentGlyph

g = CurrentGlyph()
myPen = g.getPen()

# myPen is a pen object of a type meant for
# constructing paths in a glyph.
# So rather than use this pen with the glyph's
# own draw() method, we're going to tell it
# to do things ourselves. (Just like DrawBot!)
print myPen

myPen.moveTo((344, 645))
myPen.lineTo((647, 261))
myPen.lineTo((662, -32))
myPen.lineTo((648, -61))
myPen.lineTo((619, -61))
myPen.lineTo((352, 54))
myPen.lineTo((72, 446))
myPen.lineTo((117, 590))
myPen.lineTo((228, 665))
myPen.closePath()
myPen.moveTo((99, 451))
myPen.lineTo((365, 74))
myPen.curveTo((359, 122), (376, 178), (420, 206))
myPen.curveTo((422, 203), (142, 579), (142, 579))
myPen.closePath()
Exemplo n.º 4
0
# robothon06
# get a pen and draw something in the current glyph
# what will it draw? ha! run the script and find out!

from robofab.world import CurrentGlyph

g = CurrentGlyph()
myPen = g.getPen()

# myPen is a pen object of a type meant for
# constructing paths in a glyph.
# So rather than use this pen with the glyph's
# own draw() method, we're going to tell it 
# to do things ourselves. (Just like DrawBot!)
print myPen

myPen.moveTo((344, 645))
myPen.lineTo((647, 261))
myPen.lineTo((662, -32))
myPen.lineTo((648, -61))
myPen.lineTo((619, -61))
myPen.lineTo((352, 54))
myPen.lineTo((72, 446))
myPen.lineTo((117, 590))
myPen.lineTo((228, 665))
myPen.closePath()
myPen.moveTo((99, 451))
myPen.lineTo((365, 74))
myPen.curveTo((359, 122), (376, 178), (420, 206))
myPen.curveTo((422, 203), (142, 579), (142, 579))
myPen.closePath()