Because canvas doesn't store layers, it is essentially just a bitmap.
If I drew a black box on a canvas, and then a blue circle on top of that black box, the canvas element does not keep the part of the box under the circle in memory; instead, it replaces the old "lower layer" bitmap data with the new "higher layer" bitmap data. So there is no built-in way of deleting that circle and having the canvas revert to the box data that was drawn first underneath the circle, which is essentially what layers are.
If you stack canvas elements on top of each other, one canvas per layer, then this restriction no longer exists - One canvas can store the box and the other can store the circle. That way, if I delete some of the circle, the canvas doesn't have to remember what was underneath it before, it just has to be transparent to let the next-lowest canvas bitmap shine through.
I've done canvas coding before. I made a UI for an audio player entirely in canvas. Canvas allows you to manipulate an array of pixels. You could keep a separate array for each layer, maybe you have to coordinate between them, but it seems entirely possible. You could generate an output array as a matrix operation on the arrays of layers or do some other kind of merging logic? The only difference I can see between canvas and a modern gui (other than speed) is that someone else has already written these libraries for the gui so you don't have to.
I still don't see why anyone would say it's impossible and I'm not sure why I'm getting voted down for asking this technical question. If someone thinks I'm wrong they should at least explain it as you did.
I completely agree with you WRT downvoting... I'd much prefer a discussion like this to a buried comment, regardless of the merit of the original comment. Perhaps it was due to the perceived tone of your comment: "I don't understand why anyone would think it would be impossible" ~= "Who would be dumb enough to assume this isn't possible?" As for why anyone would claim the task is impossible - not enough imagination! :) Although it's more likely that they meant they thought it was impossible to achieve at a decent speed/framerate, which is a pretty reasonable assumption at first glance.
Technically, I think you're right - you could implement a pseudolayering system with only one canvas element. The limiting factor, however, is redrawing speed. You have essentially two options - every time a layer moves, you could redraw the entire canvas, which is conceptually easy but slow. Or you could do some calculation to determine exactly which pixels need to be redrawn - as you say, a matrix operation to determine a delta matrix. This may be faster than redrawing the entire canvas, but it gets much slower as you increase the number of layers. Speed may not seem like a huge issue here, but imagine clicking a layer and dragging it around - this would require constant (un-hardware-accelerated) canvas redrawing at ~10-30fps, which is probably pretty difficult to achieve with any significantly-sized canvas.
The brilliant canvas-on-top-of-canvas implementation avoids this problem altogether. While the layer being dragged still has to be redrawn, the process of doing so is made a lot easier because you don't have to shuffle around the data in the other layers in the process, you just have to worry about one layer at a time.
"I don't understand why anyone would think it would be impossible" ~= "Who would be dumb enough to assume this isn't possible?"
If that's how they feel about themselves they shouldn't take it out on me ;)
Back on topic, can there be multiple objects on a layer? If so what happens when you drag one on top of another object on the same layer? I haven't used the app, so this may be a dumb question. These are the sorts of things that gave me headaches when I made my audio player UI, and it seems to lead to the same sort of data shuffling that you'd have with multiple matrices.
Impossible might have been hyperbole on my part. I recall a discussion about a different, simpler HTML5 drawing app (no layers) here on HN in which someone claimed that HTML5 is no alternative to Flash based solutions since layers would be – and that’s how I remember it – impossible with Canvas. It is possible that he just said hard, not impossible.