Skip to content

Commit cf4caae

Browse files
committed
Added example of uv coord usage in vertex
1 parent d626147 commit cf4caae

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/shape/custom_shapes.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,46 @@ function customShapes(p5, fn) {
23002300
* }
23012301
* </code>
23022302
* </div>
2303+
*
2304+
* <div>
2305+
* <code>
2306+
* let vid;
2307+
* function setup() {
2308+
* // Load a video and create a p5.MediaElement object.
2309+
* vid = createVideo('/assets/fingers.mov');
2310+
* createCanvas(100, 100, WEBGL);
2311+
*
2312+
* // Hide the video.
2313+
* vid.hide();
2314+
*
2315+
* // Set the video to loop.
2316+
* vid.loop();
2317+
*
2318+
* describe('A rectangle with video as texture');
2319+
* }
2320+
*
2321+
* function draw() {
2322+
* background(0);
2323+
*
2324+
* // Rotate around the y-axis.
2325+
* rotateY(frameCount * 0.01);
2326+
*
2327+
* // Set the texture mode.
2328+
* textureMode(NORMAL);
2329+
*
2330+
* // Apply the video as a texture.
2331+
* texture(vid);
2332+
*
2333+
* // Draw a custom shape using uv coordinates.
2334+
* beginShape();
2335+
* vertex(-40, -40, 0, 0);
2336+
* vertex(40, -40, 1, 0);
2337+
* vertex(40, 40, 1, 1);
2338+
* vertex(-40, 40, 0, 1);
2339+
* endShape();
2340+
* }
2341+
* </code>
2342+
* </div>
23032343
*/
23042344
/**
23052345
* @method vertex

0 commit comments

Comments
 (0)