Jump to content

Phaser & SVG Files


Manifest
 Share

Recommended Posts

  • 2 months later...

Had some luck drawing SVG from inkscape to Phaser using Canvas, although it is a bitmap.

The latest Inkscape version 0.91 can save your SVG as HTML 5 Canvas, so all I did was draw my image, then save as HTML5 canvas.
 

It generates an HTML5 script with your lines and bezier curves data points and path, then you simply prefix it with your variable name.

You have to create a bitmapData object first, e.g.,
 var theSVGimage = game.make.bitmapData(300,300);

theSVGimage.ctx.beginPath();

...and so on. Paste the Inkscape generated ctx code here.

 

Link to comment
Share on other sites

  • 1 month later...
On 4/1/2014 at 9:54 PM, rich said:

I may experiment supporting loading SVG files then :) They would have to render to bitmaps of course, as the game itself cannot (and should not) run in SVG, but at least it would let you load and use the assets.

People would use the vector 2 bitmap trick in Flash. Though I got away with vectors, it was likley to optimization behind the scenes. I suspect browser JS engines will some day have the same capability. If not through engine optimization than through miniaturization of computer parts.

Link to comment
Share on other sites

  • 3 months later...
  • 5 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...