123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import svgwrite
- # 29.7 cm width 25 is a safe printable area
- # 21.9 cm width 17 is a safe
- def makePoly(document, numberOfCircles, radius, yval, colorOfFill, colorOfStroke):
- widthOfPage = float(document.attribs["width"][:-2])
- x = 0
- y = yval
- for n in range(numberOfCircles):
- positionOnPage = x * horizontal_distance
- document.add(document.circle(center=(positionOnPage, y),r=radius, fill = colorOfFill, stroke = colorOfStroke))
- if positionOnPage < 841:
- x += 1
- else:
- x = 0
- y += 50
- yy = 50
- for z in range(5):
- if z == 0:
- document.add(document.circle(center=(0, yy),r=radius, fill = 'black', stroke = 'black'))
- else:
- horizontal_total = (z * 1998)
- positionOnPageTwo = horizontal_total - (int(horizontal_total / 840) * 840)
- document.add(document.circle(center=(positionOnPageTwo, yy),r=radius, fill = 'black', stroke = 'black'))
- yy += 50 * (int((z * 1998)/840))
- svg_document = svgwrite.Drawing(filename = "hyperobject.svg", size = ("841.89px", "595.28px"))
- numberOfLargeCircles = 333
- numberOfSmallCircles = 5
- horizontal_distance = 30
- proportion_horizontal_distance = (333 / 5) * 30
- #makePoly(svg_document, numberOfSmallCircles, 2, 50, proportion_horizontal_distance, 'white', 'pink') # 820 first arg
- makePoly(svg_document, numberOfLargeCircles, 8, 75, 'red', 'red') # widthOfPage, numberOfCircle, radius, yval
- svg_document.save()
|