Create an outline, from a path

Hi all,

I need to create an outline from a provided Phaser path object (or, if it’s easier, a Tiled polyline).
So, what I mean is that, from an existing path, I’d like to create a new path that is an outline of X pixels from that path.

There’s a good, if largely incomprehensible tutorial on the logic here: https://assist-software.net/blog/how-draw-outline-around-non-closed-polygon

Before I break my tiny little mind attempting to work my way through that, I just thought I’d ask if anyone knows of an existing plugin, function or at least, Phaser or Javascript oriented tutorial?

Cheers!

Maybe something like this?
From http://stackoverflow.com/a/11970006/796832

Thanks @Milton, that’s just what I was looking for!
I didn’t actually use the example you linked to, but another answer in the same StackOverflow question had a similar example using the JSTS library, which seems designed for exactly this kind of problem.
It’s taken a bit of messing about, but I’ve got it all working. Thanks so much.