by bluetwo · 9y ago · 0 comments
I've used Processing Java and Processing.js, so I assume this is some continuation or extension of those projects.
It might be more effective if the explanation focused on the benefits of using p5, rather than just saying "It makes a circle" or "It draws a slider" (which are features).
For instance, maybe some of these are true:
- p5 speeds the creation of animations on your site
- p5 allows beginners to create complex interactions compatible across devices
- p5 allows low-cost prototyping of game designs
- p5 shrinks site size by replacing videos with animations
Of course you would have to look to the community and beyond to figure of which resonate with potential users.
This sounds unnecessarily negative. Even in the light of pure artistic realisation, I found 3 of the 4 points still very good.
The first point _is_ very much about artistic realisation:
- p5 speeds the creation of animations on your site
The second and last point are about the accessibility of the artistic stuff. Some don't care, but others want to show their stuff and all their intermediate stuff to the widest audience possible:
- p5 allows beginners to create complex interactions compatible across devices
- p5 shrinks site size by replacing videos with animations
But as gp said, this list is just an inspiration and the real list of benefits needs to be determined empirically with the community of (potential) users.
I work in an academic environment and was introduced to web development as part of the projects I am working on. The simple interface made it easy to put something together under tight deadlines with little/no Web experience, but experience working with GUIs in other systems.
I remember flash games working really fast on my phone. However, when a bunch of (~100?) circles appeared on the screen, the video started lagging.
I wonder if games/animations compiled to webassembly would work a lot faster.
There aren't many applications where d3 or raw js wouldn't be a more performant solution for commercial graphics.
p5 defaults to either canvas or WebGL and uses abstractions barely add any overhead to raw JS. Where sensible it uses typed arrays internally[1], for example. By comparison, d3 uses SVG and DOM manipulation by default, and everything is trees of objects (as a consequence, creating datavisualisations is also done an entirely different style, btw, since p5 uses a draw-loop for each frame, and d3 uses an enter/update/exit paradigm).
So unless you manually take steps to use the canvas (which is possible, but not the default), I doubt that d3 usually beats p5 (pixi however, is another story[2]).
But really, as long as you know how to write fast JS code, you can write fast p5 code. EDIT: note that the examples are not necessarily the fastest possible code, since they are more about showing code examples.
[0] http://processingjs.org/learning/