← Back to Documentation Index

🖥️ Fullscreen Button

Universal fullscreen toggle button for all demos

📋 Overview

The Fullscreen Button provides a user-friendly toggle for entering and exiting fullscreen mode, automatically positioned in the lower-right corner of every demo.

💡 Features
  • One-Click Toggle - Enter/exit fullscreen easily
  • ESC Key Support - Exit with Escape key
  • Auto-Positioning - Fixed to bottom-right corner
  • Cross-Browser - Works in all modern browsers
  • Visual Feedback - Icon changes based on state

🖥️ Fullscreen Functions

createFullscreenButton(canvas)

Creates a fullscreen button for the canvas.

canvas HTMLCanvasElement - Canvas element to make fullscreen
Returns: object - FullscreenButton instance
Example:
const fsButton = createFullscreenButton(canvas);
toggleFullscreen()

Manually toggles fullscreen mode.

Returns: void - No return value
Example:
if (isKeyPressed("f")) toggleFullscreen();