-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make interactive live sketch for Shape examples #314
Comments
I thought about it. We're just trying to emulate the behavior of Processing in a web page so I can't see why we would have to use p5.js if another lib gets the job done. I would say just do it 😉 |
Sounds reasonable, can't argue that ^^', but wanted some confirmation.
The slowness may be due to this: every draw() call inserts nodes in the DOM. Have you tried the "workaround" with your tests? Here is a recent blog post explaining the issue (see the penultimate section). I still think the best option for working with SVGs is p5.js-svg, as it is (or seems to be) the least cumbersome to use and include in a project (no need for Nodejs dependencies). Thus, if the workaround fixes the slowness, I would stick to p5.js-svg. Do you agree? |
Working examplesHello, after trying out some of the libraries, I finally chose Paperjs. I have made a repository with working examples for both tasks: "scale shape" and "shape vertices". These examples a very minimal. Instructions on how to get them running are explained there. Why Paperjs?The reasons why I decided to choose Paperjs, which I think is the best option, are partially explained in my repo's readme file. But I will be a slightly more precise here
Will I issue a PR to processing-website repo?No. The website is built with nodejs, reactjs and some other tools I have very little idea of. Therefore, either somebody volunteers to give me a hand with it, or that somebody makes the changes to the website by him/herself. Relation to issue #310I think it is worth to mention that if you run the example "scale shape" of my repository, the problem in issue #310 does not happen. But that is another topic. |
Thanks @trikaphundo that looks great! Asking @runemadsen: what would be the best way to allow examples to import other libraries than p5.js if needed? How about adding a line to the Assuming we add the library files to the example folder, it would look something like this: {
"name": "",
"title": "",
"author": "",
"description": "",
"featured": ["", "", ""]
"import": ["libs/paper-core.min.js"]
} Ideally it could also support importing via a CDN, like this: "import": ["https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.15/paper-core.js"] |
Since we're already loading p5 from a CDN I would suggest the second option. It shouldn't be too hard to add an array of imports to inject onto the page in the same way that we do now. |
The following examples still need to be ported to JavaScript:
However, since there is currently no support for SVGs in p5.js this has to be done another way.
I made a brief attempt at porting the Scale Shape example using p5.js-svg but it was too slow for real-time interaction. You might need to use a different library like paper.js or snap.svg
The following examples are not animated nor interactive so porting them is not strictly necessary:
For information on how to make live sketches for examples, please check the README on examples
The text was updated successfully, but these errors were encountered: