Show HN: Paths.js – Generate SVG paths for geometric shapes
11–20 of 29 posts
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#12So is the primary purpose of the library to save you from having to type "M 0 0 L 1 0 L 1 1", instead letting you type "Path().moveto(0, 0).lineto(1, 0).lineto(1, 1).print()"?
The actual purpose of library is to provide with more complex shapes and graphs, while still leaving you the possibility to write a path by hand, should the need arise.
Moreover, consider that even if you stay wit the lowest level API, the data you have may be dynamic, so that it may be easier to call a function with parameters at every frame, rather than hand-concatenating string (although this use is admittedly rather limited)
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#13So is the primary purpose of the library to save you from having to type "M 0 0 L 1 0 L 1 1", instead letting you type "Path().moveto(0, 0).lineto(1, 0).lineto(1, 1).print()"?
This looks super useful for the many circumstances where interpolating things into strings to generate SVG paths is quite unpleasant (ie. anything much beyond "M #{x} #{y}").
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#14Any core differences between Path.js and D3?
Well, there are a few. The main one is that Paths.js only builds a descriptor of your path (the string that goes into the "d" attribute of the SVG path tag), and leaves to you the actual rendering. This has, for me, a few benefits: - it is easier to integrate into frameworks like React or Angular (because both these frameworks and D3 think they have control on what goes rendered in the page) - you can use templating,…
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#15Any core differences between Path.js and D3?
Well, there are a few. The main one is that Paths.js only builds a descriptor of your path (the string that goes into the "d" attribute of the SVG path tag), and leaves to you the actual rendering. This has, for me, a few benefits: - it is easier to integrate into frameworks like React or Angular (because both these frameworks and D3 think they have control on what goes rendered in the page) - you can use templating,…
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#16So is the primary purpose of the library to save you from having to type "M 0 0 L 1 0 L 1 1", instead letting you type "Path().moveto(0, 0).lineto(1, 0).lineto(1, 1).print()"?
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#17Earlier quoted context omitted.
Well, there are a few. The main one is that Paths.js only builds a descriptor of your path (the string that goes into the "d" attribute of the SVG path tag), and leaves to you the actual rendering. This has, for me, a few benefits: - it is easier to integrate into frameworks like React or Angular (because both these frameworks and D3 think they have control on what goes rendered in the page) - you can use templating,…
Thanks! make sense. I have observed that lot of JS based SVG libraries having memory leaks and slowing down browser over the time, how paths.js behaves in this context?
SVG itself is certainly not the fastest technology around, considering that the browser has to adjust the layout of the HTML and SVG together. Still it seems to work just fine for a few charts.
The only exception to the above is the Graph chart. That one is currently hideously slow, and one of the tasks for release 0.4 is to optimize it. The algorithm does not look too bad to me, but probably I am producing a lot of intermediate garbage which slows down the whole animation. I will have to look into some form of object pooling.
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#18Coffescript isn't for everyone, on the web Javascript should be considered the lingua franca.
By all means, keep the Coffescript if you like, just don't limit it to just a non-standard language web-wise. I can test JS in my browser, with coffescript... Not so much.
Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#19Re: Show HN: Paths.js – Generate SVG paths for geometric shapes
#20So is the primary purpose of the library to save you from having to type "M 0 0 L 1 0 L 1 1", instead letting you type "Path().moveto(0, 0).lineto(1, 0).lineto(1, 1).print()"?
Consider, why do people use SQL query builders when you could just use a string?
SQL query builders can have the capability that they make queries composable.
Sending a string around will require you to do double and tripple check for parameters, logical combinations and what not in every step of a composable action.
Besides that, most SQL query composers assist you in isolating parameters from query, and this protects you from SQL injection.