For this I think you need to base the group at 0,0 originally and then transform it from there:
- $('#divWrapper').svg(initDraw);
-
function initDraw(svg) {
-
var gr = svg.group({transform: 'translate(100, 100)'});
-
svg.line(gr,75,95,75,120,{strokeWidth: 2, stroke: "blue"});
-
.... add more elements to group
-
$(gr).animate({svgTransform: 'translate(10,10)'}, 2000);
-
}
Also, you should only access the
svg object from within the
onLoad callback (as shown above) to ensure compatibility across browsers: