var p;
var drawings = [];

var DrawingManager = function (p5Sketch) {
  p = p5Sketch;
};

DrawingManager.prototype.add = function (drawing) {
  console.log('Added ' + drawing);
  drawings.unshift(drawing);
}

DrawingManager.prototype.drawAll = function () {
  for (var i = drawings.length - 1; i >= 0; i--) {
    drawings[i].draw(p);

    if (drawings[i].done()) {
      drawings.splice(i, 1);
    }
  };
}

DrawingManager.prototype.update = function (pulse, config) {
  for (var i = drawings.length - 1; i >= 0; i--) {
    if (drawings[i].pulse.name === pulse.name) {
      drawings[i].update(p, pulse, config);
      console.log("UPDATED pulse", drawings[i].pulse.name);
    }
  }
}

DrawingManager.prototype.clear = function () {
  drawings = [];
}

module.exports = DrawingManager;
@@ -18,16 +18,37 @@
 gs = %5B%5D;
+%0Avar lowerLayer = %5B%5D;
 %0A%0Avar Dr
@@ -156,16 +156,91 @@
 wing) %7B%0A
+  if (drawing.pulse.layer) %7B%0A    lowerLayer.unshift(drawing);%0A  %7D else %7B%0A  
   consol
@@ -266,16 +266,18 @@
 awing);%0A
+  
   drawin
@@ -297,16 +297,20 @@
 awing);%0A
+  %7D%0A
 %7D%0A%0ADrawi
@@ -349,24 +349,180 @@
 nction () %7B%0A
+  for (var i = lowerLayer.length - 1; i %3E= 0; i--) %7B%0A    lowerLayer%5Bi%5D.draw(p);%0A%0A    if (lowerLayer%5Bi%5D.done()) %7B%0A      lowerLayer.splice(i, 1);%0A    %7D%0A  %7D;%0A%0A
   for (var i

Add a lower layer to the drawing manager