processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.11k stars 3.22k forks source link

Add first class support for SVG imports and exports #4630

Open lostPixels opened 4 years ago

lostPixels commented 4 years ago

Most appropriate sub-area of p5.js?

New feature details:

As an artist using p5.js for plotter drawings, I use vector graphics to power my Axidraw. There are very few options for this workflow out there, and p5.js has by far the best API.

Although I am still able to partially use it, the p5js.svg library was abandoned over 5 years ago. It is the only way to draw and export SVGs. It's plagued with many bugs that require a deep understanding to fix.

It would be amazing if p5.js natively supported SVG operations. The 2D API maps perfectly to it, and the only new option that would be nice is loading and manipulating external SVGs.

welcome[bot] commented 4 years ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

brunocastro commented 3 years ago

I will need to export svg in my project too. Sometimes, we needed to edit the programmatic art in vector software.

jimmymorris commented 3 years ago

+1 for this

bobcgausa commented 3 years ago

https://editor.p5js.org/Bobcook47/sketches/Dk3Osbx3z Can’t help with export But am lookin for testers on import Library handles some files and fragments

klavsbuss commented 3 years ago

+1

bobcgausa commented 3 years ago

Try my p5 import library for svg, no export though

https://editor.p5js.org/Bobcook47/present/Dk3Osbx3z

Sent from my iPad

On Feb 20, 2021, at 5:28 PM, Klavs notifications@github.com wrote:



+1

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/processing/p5.js/issues/4630#issuecomment-782758951, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAUCTBGAYANSA3MBOD2LIHTTAAZQDANCNFSM4N32FPSQ.

nataliefreed commented 3 years ago

+1 on this. Is there a place where this (support for vector exports from P5 for use with pen plotters and other digital fabrication workflows) is being discussed? I know there was a discussion here a while back, and that it's not an easy thing to implement. But not sure if it's a design question or an issue of finding someone with the expertise and time. The workflow for this is so nice in Processing, it would be incredible to have that capability in shareable web apps. There are other Javascript libraries that handle SVGs of course, but there's nothing like P5.js for tinkering and teaching.

limzykenneth commented 3 years ago

@nataliefreed No current discussions that I know of is going on though there had been pretty consistent interest in this. I think the lack of progress is mostly due to lack expertise and time. It's not a high priority project for p5.js officially at this time and I don't know of any addon projects that are working on this at the moment.

zenozeng commented 3 years ago

@nataliefreed

Hi, I just released p5.js-svg@1.0.5, which fixes a lot of bugs and should work with p5.js@1.3.1.

And the following are the examples for SVG imports and exports

jimmymorris commented 3 years ago

@zenozeng thanks for updating! this is super exciting, look forward to trying it out!

aafiyahtech commented 2 years ago

Hi @zenozeng Cool, let me check

There could be huge scope if we could import an SVG as a shape and then manipulate it in p5js, as the native shape doesn't properly support the translate function. So moving the shape becomes difficult

agrshch commented 1 month ago

It's great to see that the SVG support is added as a proposal for 2.0! SVG runtime by @zenozeng is truly amazing, but it doesn't cover all the use cases and it can be significantly slower than regular canvas. It's a solvable issue though. I used tricks like drawing everything on the canvas for preview and creating (and deleting) the second p5 instance to export the result as SVG. But it would be really nice to have an opportunity to load and export SVG files without switching runtime. Like in Processing

davepagurek commented 1 month ago

Some prior discussion on importing SVG is here for context: https://github.com/processing/p5.js/issues/5779