Reputation: 980
I create some lines in my Paper:
var svg = Snap("#svg_container");
var linesContainer = {};
var line = svg.line( 0, 0, 200, 200).attr(...);
linesContainer[someID] = line;
then i clear the Snap / create a new. I want to have the stored object also in my new snap:
svg = Snap("#svg_container");
svg.clear();
//something like:
//svg.append(linesContainer[someID]);
is this possible?
Upvotes: 0
Views: 157
Reputation: 337
Here script with using SnapSVG.
var linesContainer = []; // not {}
lineContainer[linesContainer.length] = svg.line( 0, 0, 200, 200).attr(...);
// or 2nd way .. u can definitely make objects with value x,y, attrs and store them, but it helps reducing a storage of using memory.
U can put line to svg like that.
svg = Snap("#svg_container");
svg.clear();
for(i=0;i<lineContainer.length;i++)
svg.add(lineContainer[i]);
Upvotes: 1