-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Adding missing examples to the documentation. #6751
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
671ccbf
2acda5f
446f039
0df1999
f0f0e48
5e4b094
244a61a
e10b406
8668774
b8b784b
51b9b9f
09ff1c1
f3e72da
8f91ad7
30883f0
8fedf61
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 |
---|---|---|
|
@@ -243,6 +243,32 @@ class Framebuffer { | |
* @method pixelDensity | ||
* @param {Number} [density] A scaling factor for the number of pixels per | ||
* side of the framebuffer | ||
* @example | ||
* <div> | ||
* <code> | ||
* let pg; | ||
* | ||
* function setup() { | ||
* createCanvas(150, 150); | ||
* pixelDensity(4); | ||
* pg = createGraphics(75, 75); | ||
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. I'm uncertain about whether we should include examples in all files containing the same method, such as pixelDensity, which is present in three files. If it's advisable, we could consider adding relevant examples in each corresponding file. What are your thoughts on this matter? for the example (pixelDensity), I believe we're referring to the method created on p5.framebuffer. Could we include an example related to using framebuffer instead of createGraphics? This might provide more relevant examples. What you think? 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. Yes, for |
||
* pg.pixelDensity(1); | ||
* } | ||
* | ||
* function draw() { | ||
* background(220); | ||
* fill(255, 0, 0); | ||
* ellipse(25, 25, 40, 40); | ||
* pg.background(255); | ||
* pg.fill(0, 0, 255); | ||
* pg.ellipse(50, 50, 40, 40); | ||
* image(pg, 75, 75); | ||
* } | ||
* </code> | ||
* </div> | ||
* | ||
* @alt | ||
* A red and a blue ellipse on a canvas. | ||
*/ | ||
pixelDensity(density) { | ||
if (density) { | ||
|
@@ -923,6 +949,37 @@ class Framebuffer { | |
* texture. | ||
* | ||
* @method end | ||
* @example | ||
* | ||
* <div> | ||
* <code> | ||
* | ||
* let framebuffer; | ||
* function setup() { | ||
* createCanvas(100, 100, WEBGL); | ||
* framebuffer = createFramebuffer(); | ||
* noStroke(); | ||
* } | ||
* function draw() { | ||
* framebuffer.begin(); | ||
* background(255); | ||
* translate(0, 5 * sin(frameCount * 0.01), 0); | ||
* rotateX(frameCount * 0.01); | ||
* rotateY(frameCount * 0.01); | ||
* fill(255, 0, 0); | ||
* torus(30); | ||
* framebuffer.end(); | ||
* | ||
* background(100); | ||
* image(framebuffer, -50, -50, 25, 25); | ||
* image(framebuffer, 0, 0, 35, 35); | ||
* } | ||
* </code> | ||
* </div> | ||
* | ||
* @alt | ||
* Rotating red torus displayed in different sizes on a dark gray background." | ||
* | ||
*/ | ||
end() { | ||
const gl = this.gl; | ||
|
Uh oh!
There was an error while loading. Please reload this page.