@all : there's a few way available to do a Mode7 plugin. However, I can see a few roadblocks.
The solutions and their problems :
- CSS transform : easy to do. The problem : you can't draw on a <canvas> (which is what C2 is using in the end) a DOM element while retaining the various CSS transforms and filters applied to it. If I keep it as a DOM, overlayed over the game (like the Button Object used in C2), I can't respect layers order, the Sprite is always going to float above everything else.
- WebGL transform : easy and fast. Works only on system with good WebGL support (no iOS and Android). However I pokked around C2's structure, and I have no way to grab the WebGL canvas as a texture. Perhaps @Ashley can provide me a hint here ?
- SVG transform : it's a perspective transform, and luckily it's available on desktop, and mobile (at least it works good on iOs, a little more slower on Android). The problem is the same as the one with my SVGCanvas plugin : I can decide to draw the SVG on the <canvas>. Firefox allows it without a problem. On Webkit, there's a browser-wide bug that says the <canvas> is "tainted" when drawing SVG on it, preventing the reuse of the canvas after that (to simplify).
If I don't draw the SVG inside the <canvas>, it works everywhere, but the SVG layer is going to float above everything else, like a CSS transform, and doesn't respect the layers' order.
If you don't want to use plugins (Unity, Flash, Java), there are no other way to do a Mode7, apart from pre-skewing your Sprite in your favorite image editor.
(You can always do it the old way, with hundred of canvases, each one a little smaller than the previous one, to have a skew effect, but it's not good performance-wise...)