OndrejRohon
OndrejRohon

Reputation: 337

Snapsvg transform line

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!

Upvotes: 1

Views: 1656

Answers (1)

Robert Longson
Robert Longson

Reputation: 124059

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);

Upvotes: 1

Related Questions