From 3d301a1211db12339b930daa068eaf4b97c91c14 Mon Sep 17 00:00:00 2001 From: villares Date: Sat, 30 May 2020 00:22:16 -0300 Subject: [PATCH] Update sketch_2020_05_29a.pyde --- 2020/sketch_2020_05_29a/sketch_2020_05_29a.pyde | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/2020/sketch_2020_05_29a/sketch_2020_05_29a.pyde b/2020/sketch_2020_05_29a/sketch_2020_05_29a.pyde index 404826a9..1719764f 100644 --- a/2020/sketch_2020_05_29a/sketch_2020_05_29a.pyde +++ b/2020/sketch_2020_05_29a/sketch_2020_05_29a.pyde @@ -29,7 +29,7 @@ def draw(): txt = ['t', '(0%) 0', '(100%) 1', 'c0', 'c1', 'c'] if names: ta = 't' - tb = 'c' + tb = ' c' else: ta = 't:{:.2f}'.format(a) tb = ' c:color({:.0f}, {:.0f}, {:.0f})'.format( @@ -51,6 +51,7 @@ def draw(): fill(0) stroke(100) bar(X1, pts[1], X1, pts[2], a0, a1, RIGHT, RIGHT) + right_labels(X2+26, pts[1], X2+26, pts[2], b0, b1) stroke(0) fill(pts[3]) circle(X2, pts[1], 50) @@ -62,8 +63,7 @@ def draw(): fill(0) if names: textAlign(CENTER) - caption = ('{} = lerpColor({}, {}, {})' - .format(txt[5], txt[3], txt[4], txt[0])) + caption = '{} = lerpColor(c0, c1, t)' text(caption, width / 2, 40 - y_off) else: textSize(14) @@ -121,3 +121,12 @@ def bar(x1, y1, x2, y2, t1, t2, a1, a2): else: circle(x2, y2, d) pop() + +def right_labels(x1, y1, x2, y2, t1, t2): + fill(0) + textAlign(LEFT, CENTER) + if not names: + textSize(12) + text(' {} '.format(t1), x1, y1) + text(' {} '.format(t2), x2, y2) +