Thursday, October 23, 2025
HomeLanguagesJavascriptp5.js noTint() Function

p5.js noTint() Function

The noTint() function is used to remove the fill value for images that has been previously applied using the tint() function. It will revert the tint of the images and display them with their original hues.

Syntax:

noTint()

Parameters: This function does not accept any parameters.

Below examples illustrate the noTint() function in p5.js:

Example 1:




function preload() {
  img = loadImage('sample-image.png');
}
  
function setup() {
  createCanvas(600, 300);
  textSize(22);
}
  
function draw() {
  clear();
  text("Using the tint() function", 20, 20);
  tint("red");
  image(img, 20, 40);
  
  text("Using the noTint() function", 20, 170);
  noTint()
  image(img, 20, 180);
}


Output:
tint-noTint-comparison

Example 2:




function preload() {
  img = loadImage('sample-image.png');
  disableTint = false;
}
  
function setup() {
  createCanvas(600, 300);
  textSize(22);
  
  // Create a button for toggling the
  // noTint() function
  removeBtn = createButton("Toggle using noTint");
  removeBtn.position(30, 200)
  removeBtn.mousePressed(removeTint);
}
  
function draw() {
  clear();
  text("Click on the button to use the noTint() function", 20, 20);
  text("Using noTint(): " + disableTint, 20, 40);
  
  // Check if the boolean value is true
  // to use the noTint() function
  // in this draw loop
  if (disableTint) noTint();
  
  image(img, 30, 60);
  
  // Using the tint() function here
  // would tint the image in the next
  // draw loop
  tint("red");
}
  
function removeTint() {
  // Toggle the use of noTint()
  disableTint = !disableTint;
}


Output:
toggle-noTint

Online editor: https://editor.p5js.org/

Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/

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

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

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS