Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptp5.js noCursor() function

p5.js noCursor() function

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments