p5.js | Constants | PI
The PI is a mathematical constant with the value 3.14159265358979323846. It is the circumference’s ratio of a circle to its diameter.
Syntax
PI
Below program illustrates the usage of PI in p5.js:
Example:
function setup() { //create Canvas of size 880*200 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 PI arc(50, 50, 280, 280, 0, PI / 2); noStroke(); textSize(20); text("Value of PI is " + PI, 30, 250); } |
chevron_right
filter_none
Output:

Reference: https://p5js.org/reference/#/p5/PI
Recommended Posts:
- p5.js | Constants | TAU
- p5.js | Constants | TWO_PI
- PHP | Magic Constants
- p5.js | Constants | QUARTER_PI
- p5.js | Constants | HALF_PI
- PHP | Defining Constants
- How to hide or show one record from an ng-repeat within a table based on ng-click?
- How to check whether an array is subset of another array using JavaScript ?
- How to set placeholder value for input type date in HTML 5 ?
- How to check if a number evaluates to Infinity using JavaScript ?
- How to print a number with commas as thousands separators in JavaScript?
- HTML | Marquee scrolldelay attribute
- HTML | Marquee stop Method
- HTTP headers | Cookie
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



