# --------------------------
# imports
import sys
sys.path.append("..")
from helper_functions import *
# --------------------------
# settings
p_w, p_h = 1000, 1000
margin = 40
dia = 4
steps = 600
# lissajous values
a = 2 # 2, 3, 4 are decent values
b = a + 1
delta = 0 # pi/2, pi/3, pi/4
f_name = "habaroll8"
axes = ['wght', 'wdth']
# --------
axis1_min = listFontVariations(f_name)[axes[0]]['minValue']
axis1_def = listFontVariations(f_name)[axes[0]]['defaultValue']
axis1_max = listFontVariations(f_name)[axes[0]]['maxValue']
axis2_min = listFontVariations(f_name)[axes[1]]['minValue']
axis2_def = listFontVariations(f_name)[axes[1]]['defaultValue']
axis2_max = listFontVariations(f_name)[axes[1]]['maxValue']
axis_w = p_w - 2 * margin
axis_h = p_h - 2 * margin
def_x = map_val(axis1_def, axis1_min, axis1_max, 0, axis_w)
def_y = map_val(axis2_def, axis2_min, axis2_max, 0, axis_h)
# --------------------------
# functions
def a_page():
newPage(p_w,p_h)
fill(1)
rect(0, 0, p_w, p_h)
translate(margin, margin)
fill(0.92, 0.90, 0.87)
rect(0, 0, axis_w, axis_h)
font(f_name)
fontSize(820 )
# --------------------------
# Drawings
pts = []
for st in range(steps):
# newDrawing()
a_page()
angle = 2 * pi / steps * st
x = .5 + .5 * sin( a * angle + delta )
y = .5 + .5 * sin( b * angle )
curr_axis1 = ip(axis1_min + 20, axis1_max - 20, x)
curr_axis2 = ip(axis2_min + 20, axis2_max - 20, y)
var_values = { axes[0] : curr_axis1, axes[1] : curr_axis2 }
fontVariations(**var_values)
#black ring to avoid the background "bleed through"
fill(None)
stroke(0)
strokeWidth(60)
oval(125, 95, 700, 700)
# the black part (fake 3D)
stroke(0)
strokeWidth(4)
fill(0)
text('A', (axis_w/2, axis_h/8), align = 'center')
# the pink blob letter
stroke(None)
fill(0.79, 0.52, 0.67)
scale(x=1.25, y=1.25)
translate(x=-95, y=-80)
text('A', (axis_w/2, axis_h/8), align = 'center')
# the blob shadow (would be great to have the shadow behind the pink blob!)
fill(0)
translate(-120, 110)
scale(x=0.9, y=-.05)
skew(25, 0)
rotate(-3)
text('A', (axis_w/2, axis_h/8), align = 'center')
saveImage('lissajous_var_test12.gif')