Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Great point! Unfortunately I do most of these generative art experiments as SVGs to feed to an axidraw machine (https://shop.evilmadscientist.com/productsmenu/846), but gut feeling says that in these canvas examples where sampling screen colors is possible your suggested method would be faster, and much more so for smaller lines and if the canvas is big.

I'll try to make an edit to the article where I try it out when I'm off work.

Thanks for the tip!



SVG also has functions for hit testing [1][2] but I have no experience or at least memories of using them. So no idea if they could be useful and performant enough. But given that interactive SVGs might require finding the object under the mouse cursor as it moves, I would expect this to be reasonable performant, but it might of course still be too slow when used while drawing hundreds or thousands of objects.

[1] https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometry...

[2] https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometry...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: