Open In App
Related Articles

p5.js Constants and Structure Complete Reference

Improve Article
Improve
Save Article
Save
Like Article
Like

Like a variable created with let, const keyword to define a new variable. The difference in const variable declaration than others is that it cannot be reassigned. And the structure are the inbuilt function used while execution. The methods are mentioned below.

Constants

Description

HALF_PIIt is a mathematical constant and its value is 1.57079632679489661923.
PIIt is a mathematical constant with the value 3.14159265358979323846.
QUARTER_PIIt is a mathematical constant with the value 0.7853982.
TAUIt is a mathematical constant with the value 6.28318530717958647693.
TWO_PIIt is a mathematical constant with the value 6.28318530717958647693.
DEGREESIt converts a given radian measurement value to its corresponding value in degrees.
RADIANSIt converts a given degree measurement value to its corresponding value in radians.

Structure

Description

setup()It is used to set the initial environment properties and load the media file.
draw()It executes the code inside the block until the program is stopped or noLoop() is called.
remove()It removes the element and deregister all listeners.
disableFriendlyErrorsThis property is used to turned off the friendly errors.
noLoop()It stops the program after executing the draw() function.
loop()It is used to call draw() function continuously.
isLooping()It verifies that the loop() function performed successfully.
redraw()It executes the code within draw() function one time.
Last Updated : 16 Aug, 2023
Like Article
Save Article
Similar Reads
Related Tutorials