I have an empty layer (not really empty, I have drawn a grid there, so there's lines and rectangles), and another layer similar to the first layer, where I dragged and dropped multiple shapes and images. What I want to do is:
- Save the second layer (called rightLayer) using
toJSON()
: done! - Draw the saved JSON in the first layer, and save it again : not yet, because..
In the docs, I should do this :
var json = rightLayer.toJSON();
var layer1 = Kinetic.Node.create(json, 'container');
Whereas I don't want to actually create the layer, it's already there, I just need to draw on it. How do I do it without creating a variable?
A second question: Can JSON format be saved in database? I'll need to store the JSON in order to display it later.