Presentation from SVG Open 2011 on SVGo, a Go Language library for generating SVG. The presentations shows the design of the library, interactive sketching, and making pictures from your own data and data from Internet services
generated code Start(w, h int, op@ons ...string) Begin the SVG document, with op@ons Startview(w, h, minx, miny, vw, vh int) Begin the document with a viewport Gid(id string)/Gend() Begin/end a group with an id Gstyle(s string)/Gend() Begin/end a group style Def(s string)/DefEnd() Begin/end defini@on block Title(s string) Specify the document @tle Desc(s string) Specify the document descrip@on Link(href, @tle string)/LinkEnd() Link to content between Link and LinkEnd Use(x, y int, link string, style ...string) Use previously defined content End() End the SVG document
y1, x2, y2 int, s ...string) Arc(sx sy, ax, ay, r int, large, sweep bool, ex ey int, s ...string) Bezier(sx, sy, cx, cy, px, py, ex, ey int, s ...string) Path(d string, s ...string) Qbez(sx, sy, cx, cy, ex, ey int, s ...string)
ScaleXY(dx, dy float64) Translate(x, y int) Rotate(r float64) RotateTranslate(x, y int, r float64) TranslateRotate(x, y int, r float64) Gtransform(s string)
canvas.End() 1 2 3 4 function StartUp() { ... } function doStuff(element) { ... } example.com/myscript.js 1 2 3 4 Begin the document, load your func@on specify the script, by reference specify SVG elements, operate on these end the SVG document