Skip to content

Commit 430c4f2

Browse files
author
Alberto Di Biase
committed
cursor() and noCursor() inline example
1 parent 5b208f7 commit 430c4f2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/environment/environment.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ define(function(require) {
6969
* WAIT, or path for image
7070
* @param {Number} [x] the horizontal active spot of the cursor
7171
* @param {Number} [y] the vertical active spot of the cursor
72+
* @example
73+
* <div><code>
74+
* // Move the mouse left and right across the image
75+
* // to see the cursor change from a cross to a hand
76+
*
77+
* function draw() {
78+
* line(width/2, 0, width/2, height);
79+
* if (mouseX < 50) {
80+
* cursor(CROSS);
81+
* } else {
82+
* cursor(HAND);
83+
* }
84+
* }
85+
* </code></div>
7286
*/
7387
p5.prototype.cursor = function(type, x, y) {
7488
var cursor = 'auto';
@@ -149,6 +163,16 @@ define(function(require) {
149163
* Hides the cursor from view.
150164
*
151165
* @method noCursor
166+
* @example
167+
* <div><code>
168+
* function setup() {
169+
* noCursor();
170+
* }
171+
*
172+
* function draw() {
173+
* ellipse(mouseX, mouseY, 10, 10);
174+
* }
175+
* </code></div>
152176
*/
153177
p5.prototype.noCursor = function() {
154178
this._curElement.elt.style.cursor = 'none';

0 commit comments

Comments
 (0)