News for hackers. Stuff that matters.
Re:SVG can do that? by marcus_holmes on Wednesday August 16, 2017 @01:17AM (#15025111)
When I started learning React, I realised a dream of mine could finally come true: a proper Celtic Knotwork generator. Uses SVG and React together in harmony.

http://celtic-knotwork.online

Re:SVG can do that? by vog on Wednesday August 16, 2017 @04:55AM (#15025960)
Pardon my ignorance, but aren't these patterns just composed of certain tiles in rows and columns? This is something you can do equally well with raster graphics, so what's the gain of using SVG here?
Re:SVG can do that? by marcus_holmes on Wednesday August 16, 2017 @12:26PM (#15028779)
I tried that on an earlier version, but there's complications ;)

The "double corded" style paints one side of a cord red and the other blue. The problem comes when the pattern changes what side is which. You can play around with it to see - put in some breakpoints and you'll see the "sides" switch on some cells. This can't be done with tiles.

The tile manipulation is actually no simpler than drawing SVG, because the hard bit is calculating the entry and exit points for each tertiary cell. And SVG produces better results :)

I also plan on doing some more stuff with it someday - like deforming the grid by moving the corners. This is pretty simple with SVG but would be really hard with tiles.

Re:SVG can do that? by detritus on Wednesday August 16, 2017 @05:12AM (#15026031)
Scalable vector output?
Re:SVG can do that? by weavie on Wednesday August 16, 2017 @09:25AM (#15027218)
Awesome. Is the code for this open source? (I'm just afraid the world could lose this should you decide to take it down some day!)
Re:SVG can do that? by marcus_holmes on Wednesday August 16, 2017 @12:31PM (#15028833)
Not yet - it's on github (the site runs off Github pages) but I need to prune the repo of private keys before I open-source it. Given the reaction here, I'll try and open it over the weekend :)
Re:SVG can do that? by HolyHaddock on Wednesday August 16, 2017 @06:29AM (#15026371)
That's delightful, thank you for posting it!