Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

p5.js | fullscreen() function

  • Last Updated : 16 Apr, 2019

The fullscreen() function in p5.js is used to get the current fullscreen state of the user’s browser window. If an argument is given, sets the sketch to fullscreen or not based on the value of the argument. If no argument is given, returns the current fullscreen state. Note that due to browser restrictions this can only be called on user input.

Syntax:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

fullscreen()

Parameters: The function does not accept any parameters.

Below program illustrates the fullscreen() function in p5.js:



Example:




function setup() {
      
    // Set the background color
    background(200);
}
function mousePressed() {
      
    // Set the value of fullscreen
    // into the variable
    let fs = fullscreen();
      
    // Call to fullscreen function
    fullscreen(!fs); 
}

Output:
Before Clicking the screen:

After Clicking the screen:

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!