Friday, August 29, 2025
HomeLanguagesJavascriptp5.js Constants TAU

p5.js Constants TAU

The TAU is a mathematical constant and it is the alias of TWO_PI. The value of TAU is 6.28318530717958647693. It is twice the ratio of the circumference of a circle to its diameter.

Syntax:

TAU

Below program illustrates the usage of TAU in p5.js:

Example: This example illustrates the TAU constant.




function setup() {
  
    // Create Canvas of size 880*300
    createCanvas(880, 300);
}
  
function draw() {
      
    //Set the background Color
    background(220);
      
    //Set the stroke color
    stroke(255, 204, 0);
      
    //Set the stroke weight
    strokeWeight(4);
      
    // Use of constant TAU
    arc(180, 50, 280, 280, 0, TAU/2); 
      
    noStroke();
      
    // Set the font size
    textSize(20);
      
    // Display result
    text("Value of TAU is "+ TAU, 30, 230);
}


Output:

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

RELATED ARTICLES

Most Popular

Dominic
32249 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6617 POSTS0 COMMENTS
Nicole Veronica
11791 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11838 POSTS0 COMMENTS
Shaida Kate Naidoo
6731 POSTS0 COMMENTS
Ted Musemwa
7012 POSTS0 COMMENTS
Thapelo Manthata
6689 POSTS0 COMMENTS
Umr Jansen
6701 POSTS0 COMMENTS