ill-tempered-seabass/svgturtletest.py

44 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
import svgturtle
print('<svg viewBox="0 0 2000 2000" xmlns="http://www.w3.org/2000/svg">')
turtle_tl = svgturtle.SvgTurtle(500, 750)
turtle_tr = svgturtle.SvgTurtle(1500, 750)
turtle_bl = svgturtle.SvgTurtle(500, 1000)
turtle_br = svgturtle.SvgTurtle(1500, 1000)
ANGLE=0
for i in range(7):
turtle_tl.home()
turtle_tl.left(ANGLE)
turtle_tl.circle(110+i*50, (i+1)*45, 50)
turtle_bl.home()
turtle_bl.right(ANGLE)
turtle_bl.circle(-(110+i*50), (i+1)*45, 50)
turtle_tr.home()
turtle_tr.right(ANGLE)
turtle_tr.circle(140+i*50, (i+1)*45, 50)
turtle_br.home()
turtle_br.left(ANGLE)
turtle_br.circle(-(140+i*50), (i+1)*45, 50)
print('<path fill="none" stroke="black" d="%s %s %s %s"/>' % (turtle_tl.to_s(), turtle_tr.to_s(), turtle_bl.to_s(), turtle_br.to_s()))
turtle_tl.reset()
turtle_tr.reset()
turtle_bl.reset()
turtle_br.reset()
for i in range(8):
turtle_tl.home()
turtle_tl.left(ANGLE)
turtle_tl.circle(100+i*50, (i+1)*45)
turtle_bl.home()
turtle_bl.right(ANGLE)
turtle_bl.circle(-(100+i*50), (i+1)*45)
turtle_tr.home()
turtle_tr.right(ANGLE)
turtle_tr.circle(130+i*50, (i+1)*45)
turtle_br.home()
turtle_br.left(ANGLE)
turtle_br.circle(-(130+i*50), (i+1)*45)
print('<path fill="none" stroke="blue" d="%s %s %s %s"/>' % (turtle_tl.to_s(), turtle_tr.to_s(), turtle_bl.to_s(), turtle_br.to_s()))
print('</svg>')