-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Increasing Access
p5.js is already very capable of being used to create custom software within the browser thanks to the framework + the DOM functions that allow one to quickly build a graphical user interface. Nevertheless, it requires quite some style hacking and additional javascript to take it further and really build a tool within the environment. This small addition would allow those learning p5.js to create new custom tools to solve a given problem, lowering the threshold and curve that may be needed to accomplish this task using additional frameworks.
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build Process
- Unit Testing
- Internalization
- Friendly Errors
- Other (specify if possible)
Feature request details
When teaching courses with p5.js, I often love to use it to create small custom programs (with GUI, ie webapps), which reveals how creative coding can enable one to create their own tools. Sometimes they are complex tools for designing posters, manipulating imagery, creating animations, VJing, etc etc – however they all tend to use the DOM functions to create a basic graphical user interface (GUI) to give users access to variables/parameters within the sketch. This GUI panel is usually placed far LEFT or RIGHT, which isn't always the ideal position. Within most software, we're used to being able to drag and move a given GUI panel anywhere to our liking. With a quick search, I found this great snippet on W3SCHOOLS, which could be easily integrated with the existing p5.element code, to enable one to simply write:
.draggable()
- to allow the given p5.element to be draggable, or
.draggable(elm)
- to move another elm with given elm (ie, title bar of GUI panel)
Here's a quick example of how it would work, a beta function already implemented (still needs documentation): https://editor.p5js.org/ffd8/sketches/phY_pHqaL
Curious what others think– is it useful, does usage/wording sounds correct, ie draggable()
or if it's better to use drag()
to be similar to the existing drop()
function?