thanks for the example, I didn’t know about
svg.path. (in order to use it inside DrawBot, you have to install it for Python 3.6 – see some problems importing noise module)
you can only have one segment for this formula
a contour is made out of several segments, so you need to loop over the contour and get
(p1, p2, p3, p4) for each segment.
here’s an example, using the same
getPoint() function from the gist:
steps = 13 r = 5 B = BezierPath() B.text('a', (90, 120), fontSize=1400) fill(0, 1, 1) drawPath(B) fill(1, 0, 0) for contour in B.contours: for i, segment in enumerate(contour): if i == 0 and contour.open: continue # the first point in a segment # is the last point from the previous segment # tip: use modulo division! p1 = contour[(i-1) % len(contour)][-1] # curve segment if len(segment) == 3: p2, p3, p4 = segment # line segment else: p2 = p1 p3 = p4 = segment # draw steps for i in range(steps): t = i * 1.0 / (steps - 1) x, y = getPoint(t, p1, p2, p3, p4) oval(x-r, y-r, r*2, r*2)
hope this helps!