-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
WebGL mode documentation improvements #6167
Changes from 12 commits
1d6068d
9d96c21
17936c8
a2ef21d
29a700d
84985f3
f1a00c6
021c565
004ac1d
f4b3a9c
eed99e6
9dbe1c2
346e0a4
30d6fd4
2fafba9
699c922
04f8763
994d18f
57f3a96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,15 @@ p5.prototype._normalizeArcAngles = ( | |
* </code> | ||
* </div> | ||
* | ||
* <div> | ||
* <code> | ||
* createCanvas(100, 100, WEBGL); | ||
* arc(0, 0, 80, 80, 0, PI + QUARTER_PI, PIE, 7); | ||
* describe( | ||
* 'ellipse with a quarter missing, and the outline is segmented instead of curved' | ||
* ); | ||
* </code> | ||
* </div> | ||
*/ | ||
p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) { | ||
p5._validateParameters('arc', arguments); | ||
|
@@ -375,16 +384,27 @@ p5.prototype._renderEllipse = function(x, y, w, h, detailX) { | |
* </code> | ||
* </div> | ||
* | ||
* <div> | ||
* <code> | ||
* createCanvas(100, 100, WEBGL); | ||
* strokeWeight(7); | ||
* line(0, 0, 0, 30, 0, 0); | ||
* line(0, 0, 0, 0, 30, 0); | ||
* line(-30, -30, -30, 30, 30, 30); | ||
* describe('two lines mark the flat x and y axes while a third line spans diagonally through the third dimension'); | ||
* </code> | ||
* </div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other code examples only used the x and y parameters for line(), so I added one using the z parameters for WEBGL mode. I figure it's a good goal to show all the possible parameters in the code examples, which would mean having a 3D example for the 2D primitives. Having these scaffolded examples might naturally help users transition to WEBGL. Eg. they might know the WEBGL coordinate system is different just from their time browsing 2D primitives examples. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, it's nice to see the webGL versions with the updated signatures! If we don't think it's too much code I think it could be nice to color these lines in rgb (xyz) gizmo fashion like so https://editor.p5js.org/aferriss/sketches/qCsZ08lJ8 |
||
* | ||
*/ | ||
|
||
/** | ||
* @method line | ||
* @param {Number} x1 | ||
* @param {Number} y1 | ||
* @param {Number} z1 the z-coordinate of the first point | ||
* @param {Number} z1 the z-coordinate of the first point (for WEBGL mode) | ||
* @param {Number} x2 | ||
* @param {Number} y2 | ||
* @param {Number} z2 the z-coordinate of the second point | ||
* @param {Number} z2 the z-coordinate of the second point (for WEBGL mode) | ||
* @chainable | ||
*/ | ||
p5.prototype.line = function(...args) { | ||
|
aferriss marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The round 2D primitives have a
detail
parameter, so technically for completeness they could use an example like this to show it in action.But I think it would distract from useful parameters and examples, and
detail
doesn't seem like a popular feature for users, anddetail
is already documented well incurveDetail()
andbezierDetail()
and the 3D primitives.Maybe this should make it into the list of WEBGL vs P2D differences? Something like:
WEBGL
mode, you can specify how many vertices are drawn with adetail
parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of
Vertex Count
I think we can use p5's existing language and call itShape Detail
.Also I don't think additional examples detracts and to be honest I didn't realize the round 2d shapes even had that parameter. I think it would be a good addition, and as you note, the 3d shapes include this, so why not 2d as well?
https://p5js.org/reference/#/p5/sphere