Open In App

p5.js noCursor() function

Improve
Improve
Like Article
Like
Save
Share
Report

The noCursor() function in p5.js is used to hide the cursor from view.
Syntax

noCursor()

Parameters: This function does not accept any parameter.

Below program illustrates the noCursor() function in p5.js:
Example-1:




function setup() {
  
  createCanvas(1000, 400);
  
  // Set text size to 40px
  textSize(20); 
  
  // Call to noCursor() function
  noCursor(); 
}
  
function draw() {
 background(200);
 rect(mouseX, mouseY, 30, 30);
  text("Position of mouse is "
  +mouseX+", "+mouseY, 30, 40);
}


Output:

Example-2:




function setup() {
  
  createCanvas(1000, 400);
  
  // Set text size to 40px
  textSize(20); 
  
  // Call to noCursor() function
  noCursor(); 
}
  
function draw() {
 background(200);
 circle(mouseX, mouseY, 10);
  text("Position of mouse is "
  +mouseX+", "+mouseY, 30, 40);
}


Output:

Reference: https://p5js.org/reference/#/p5/noCursor



Last Updated : 10 Aug, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads