Skip to content

Commit 925f55b

Browse files
authored
Merge pull request #5311 from JetStarBlues/addSpecularMaterialExample
Add example for specularMaterial()
2 parents d183505 + 7187df0 commit 925f55b

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

src/webgl/material.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -712,36 +712,45 @@ p5.prototype.emissiveMaterial = function(v1, v2, v3, a) {
712712
* @param {Number} [alpha] alpha value relative to current color range
713713
* (default is 0-255)
714714
* @chainable
715-
*/
716-
717-
/**
718-
* @method specularMaterial
719-
* @param {Number} v1 red or hue value relative to
720-
* the current color range
721-
* @param {Number} v2 green or saturation value
722-
* relative to the current color range
723-
* @param {Number} v3 blue or brightness value
724-
* relative to the current color range
725-
* @param {Number} [alpha]
726-
* @chainable
727715
*
728716
* @example
729717
* <div>
730718
* <code>
731719
* function setup() {
732720
* createCanvas(100, 100, WEBGL);
721+
* noStroke();
733722
* }
723+
*
734724
* function draw() {
735725
* background(0);
736-
* ambientLight(50);
737-
* pointLight(250, 250, 250, 100, 100, 30);
726+
*
727+
* ambientLight(60);
728+
*
729+
* // add point light to showcase specular material
730+
* let locX = mouseX - width / 2;
731+
* let locY = mouseY - height / 2;
732+
* pointLight(255, 255, 255, locX, locY, 50);
733+
*
738734
* specularMaterial(250);
739-
* sphere(40);
735+
* shininess(50);
736+
* torus(30, 10, 64, 64);
740737
* }
741738
* </code>
742739
* </div>
743740
* @alt
744-
* diffused radiating light source from top right of canvas
741+
* torus with specular material
742+
*/
743+
744+
/**
745+
* @method specularMaterial
746+
* @param {Number} v1 red or hue value relative to
747+
* the current color range
748+
* @param {Number} v2 green or saturation value
749+
* relative to the current color range
750+
* @param {Number} v3 blue or brightness value
751+
* relative to the current color range
752+
* @param {Number} [alpha]
753+
* @chainable
745754
*/
746755

747756
/**

0 commit comments

Comments
 (0)