Jump to content

Draw a line from an SVG path


federicovezzoli
 Share

Recommended Posts

Hi guys, I'm trying to draw a polygon/line from the coordinates of an svg path.

I thought to use the path2d method, as it works correctly on native canvas, but I cannot make it work with pixi and couldn't fine anyone talking about it around.

Something like this, but it's not working:

let trackPath = new Path2D("M10 10 h 80 v 80 h -80 Z")
graphic = new PIXI.Graphics()
graphic.drawPolygon(trackPath)

app.stage.addChild(graphic)

Anyone?

Link to comment
Share on other sites

Path2D is awesome but pixi doesnt support it, and I have long-term plan of adding more Vector-related plugins to pixi.

Maybe you can salvage something from https://github.com/bigtimebuddy/pixi-svg ? I mean that you look at their source and see if there's actuallly a parser for strings or something like that to create your own PIXI Path that works with Graphics?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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