pack/graphics/lines.py

43 lines
1008 B
Python

import random
def main():
left = 20
width = 1
tape_height = 10
triangles = 8
points = []
for i in range(triangles*2 + 1):
if i % 2:
points.append(f"{left},{i*tape_height/(2*triangles)}")
else:
points.append(f"{left+width},{i*tape_height/(2*triangles)}")
points.append("100,10")
points.append("100,0")
print(" ".join(points))
text = '<textPath href="#packTapeNUM">PACK.PACK.PACK.PACK.</textPath>'
path = '<path id="packTapeNUM" fill="none" stroke="none" d="MOFFX OFFY l6 20">'
text_list = []
path_list = []
#path = (6, 10)
#perp = (-3, 6*10/3)
for i in range(35):
text_list.append(text.replace("NUM", str(i)))
rand = -0.2*(i%3)
path_list.append(path.replace("NUM", str(i)).replace("OFFX", f"{-3 + 3*i + 3*rand:.2f}").replace("OFFY", f"{10*rand:.2f}") )
print("".join(text_list))
print("".join(path_list))
if __name__ == "__main__":
main()