Skip to content

Instantly share code, notes, and snippets.

@jo-lang
Created November 19, 2020 12:46

Revisions

  1. jo-lang created this gist Nov 19, 2020.
    46 changes: 46 additions & 0 deletions timm_ulrichs_rotating_e.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@

    '''
    An interpretation of a work by Timm Ulrichs
    see this blog post: https://letterformarchive.org/news/shaped-text
    See other solutions in this twitter-thread:
    https://twitter.com/MauriceMeilleur/status/1329218247594561538
    '''

    # ---------------
    # S E T T I N G S
    PW = PH = 400
    amount = 25
    char = 'e'
    frames = 10
    fnt = 'Helvetica-Bold'
    # ---------------

    cell_s = PW / (amount + 4)

    f_str = FormattedString()
    f_str.append(char, font = fnt, fontSize = cell_s * 1.55)

    char_w, char_h = f_str.size()
    pth = BezierPath()
    pth.text(f_str, (-char_w/2, -char_w/2))


    for fr in range(frames):

    p_rot = fr/frames * 360

    newPage(PW, PH)
    translate(cell_s * 2, cell_s * 2 - char_h/4)

    for i in range(amount):
    for j in range(amount):
    angle = 0
    for r in range(amount):
    if (r <= i <= amount - r - 1 and r <= j <= amount - r -1):
    angle = r
    with savedState():
    translate(i * cell_s + char_w/2, j * cell_s + char_h/2)
    rotate(angle / (amount//2) * 360 + p_rot)
    drawPath(pth)

    # saveImage('Timm_Ulrichs_rotating_e.gif')