PJS disabled functions
There are numerous things on KA that don't work, yet are still a part of PJS.
Such as `sphere()`, `box()`, `let`, `float`, and `void`. This is a small list.
Why don't these work? Is it because of performance issues?
There are numerous things on KA that don't work, yet are still a part of PJS.
Such as `sphere()`, `box()`, `let`, `float`, and `void`. This is a small list.
Why don't these work? Is it because of performance issues?
I've tried using sphere before too, but as you say it didn't work
There are 2 different modes in PJS: 2D and 3D. When you use createGraphics, you can select 2D mode or 3D (P3D) mode, and it creates a new instance of PJS in that specified mode, with a new hidden canvas to draw on. The sphere and box methods are exclusive to the 3D mode. The default environment is set up in 2D mode and can't be changed later. This is a limitation of HTML5 canvases. You can only have 1 context on a single canvas. 2D mode uses the 2D context, and 3D mode uses the WebGL context.
Here's an example of how to use createGraphics to create a sphere.
"let" is ES6 syntax, which is only disabled by Oh Noes. Not for any particular reason. I think they just don't want to update it.
"float" and "void" are Java types. They don't actually do anything in Javascript since variables and functions aren't declared with types. Since PJS is a JS port of Processing, which is a Java-based thing, it's likely PJS only supports them for backwards-compatibility, but in the background they'd just be discarded.
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.