-
Notifications
You must be signed in to change notification settings - Fork 2
/
Handjet-ELGR-animation.py
47 lines (40 loc) · 1.33 KB
/
Handjet-ELGR-animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Handjet ELGR axis animation
"""
import drawBot as db
# Global settings
w, h = 400, 400
scale = 1
TEXTCOL = (0, 0, 0)
BACKCOL = (230 / 255, 250 / 255, 40 / 255)
NODECOL = (1, 1, 1)
defaults = {"wght": 400, "ELSH": 8, "ELGR": 1.0}
handjetfont = "Handjet-Regular"
# Draw a single frame
def draw(txt="a", variations={}, caption=""):
db.newPage(w * scale, h * scale)
db.scale(scale)
db.fill(*BACKCOL)
db.rect(0, 0, w, h)
txt = db.FormattedString(txt, font=handjetfont, fontSize=500, fontVariations=variations)
db.fill(*TEXTCOL)
db.stroke(None)
path = db.BezierPath()
path.text(txt, (w / 2, 95), align="center")
db.drawPath(path)
txt = db.FormattedString(caption, font="AdapterMonoPE-Regular", fontSize=11, fill=TEXTCOL)
db.text(txt, (w / 2, 40), align="center")
# Animate ELGR axis
db.newDrawing()
variations = defaults.copy()
step = 5
for elgr in range(100, 200 + step, step):
caption = "Element Grid (ELGR): %.2f" % (elgr / 100)
variations["ELGR"] = elgr / 100
draw(txt="n", variations=variations, caption=caption)
for elgr in range(200, 100 - step, -step):
caption = "Element Grid (ELGR): %.2f" % (elgr / 100)
variations["ELGR"] = elgr / 100
draw(txt="n", variations=variations, caption=caption)
db.saveImage("../../docs/animations/Handjet-ELGR-animation.gif")
db.endDrawing()