Question

When trying to transform line by matrix I am getting this error:

TypeError: Object # has no method 'line'

Here is the codepen: http://codepen.io/anon/pen/BeoyA

When I am trying to do identical transform with different shape, for examlpe circle, it works. Are matrix transforms not supported on lines? What should be correct way of moving lines then?

Thanks!

Was it helpful?

Solution

Looks like that's a bug in the library as in SVG lines are transformable. In the meantime you could use a path to create a line.

var s = Snap(600, 600),
        line = s.path("M0 0 100 100"),
        matrix = new Snap.Matrix().translate(100, 100);

line.attr({
    stroke: "#F00",
    strokeWidth: 4
});
line.transform(matrix);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top