fabricjs - Can't load SVG from URL -
i want load different shapes in fabricjs based canvas using loadsvgfromurl(), can't. documentation not complete on this. want complete example. can load string, string creates spaces creates problems when rendering. here code:
var canvas = new fabric.canvas('canvas'); fabric.loadsvgfromurl('blueflower.svg', function (objects) { var svg = fabric.util.groupsvgelements(objects, options); canvas.add(svg).centerobject(svg).renderall(); svg.setcoords(); });
i have done example on jsfiddle, create 2 objects , load svg image url, can take alook.
example: http://jsfiddle.net/tornado1979/0fbefh52/4/
the snippet load svg this:
var site_url = 'http://fabricjs.com/assets/1.svg'; fabric.loadsvgfromurl(site_url, function(objects) { var group = new fabric.pathgroup(objects, { left: 165, top: 100, width: 295, height: 211 }); canvas.add(group); canvas.renderall(); });
Comments
Post a Comment