Programmatically generate SVG (vector) images, animations, and interactive Jupyter widgets
1''' 2A library for creating SVG files or just drawings that can be displayed in 3iPython notebooks 4 5Example: 6``` 7 d = draw.Drawing(200, 100, origin='center') 8 9 d.append(draw.Lines(-80, -45, 10 70, -49, 11 95, 49, 12 -90, 40, 13 close=False, 14 fill='#eeee00', 15 stroke='black')) 16 17 d.append(draw.Rectangle(0,0,40,50, fill='#1248ff')) 18 d.append(draw.Circle(-40, -10, 30, 19 fill='red', stroke_width=2, stroke='black')) 20 21 p = draw.Path(stroke_width=2, stroke='green', 22 fill='black', fill_opacity=0.5) 23 p.M(-30,5) 24 p.l(60,30) 25 p.h(-70) 26 p.Z() 27 d.append(p) 28 29 d.append(draw.ArcLine(60,-20,20,60,270, 30 stroke='red', stroke_width=5, fill='red', fill_opacity=0.2)) 31 d.append(draw.Arc(60,-20,20,60,270,cw=False, 32 stroke='green', stroke_width=3, fill='none')) 33 d.append(draw.Arc(60,-20,20,270,60,cw=True, 34 stroke='blue', stroke_width=1, fill='black', fill_opacity=0.3)) 35 36 d.setPixelScale(2) # Set number of pixels per geometry unit 37 #d.setRenderSize(400,200) # Alternative to setPixelScale 38 d.saveSvg('example.svg') 39 40 d # Display in iPython notebook 41``` 42''' 43 44from .raster import Raster 45from .drawing import Drawing 46from .elements import * 47