From 452571ae62eaa00419ff2463f14dada5c8325bdd Mon Sep 17 00:00:00 2001 From: "Sharad." Date: Sun, 13 Sep 2026 08:12:46 +0000 Subject: [PATCH] docs: add isLooping() reference Add English reference page and example for isLooping(), and link it from loop() and noLoop() related entries. Fixes processing/processing-website#703 --- .../processing/isLooping_/isLooping_0.pde | 21 +++++++++++++++++++ .../en/processing/isLooping_.json | 12 +++++++++++ .../translations/en/processing/loop_.json | 2 +- .../translations/en/processing/noLoop_.json | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 content/references/examples/processing/isLooping_/isLooping_0.pde create mode 100644 content/references/translations/en/processing/isLooping_.json diff --git a/content/references/examples/processing/isLooping_/isLooping_0.pde b/content/references/examples/processing/isLooping_/isLooping_0.pde new file mode 100644 index 000000000..3c67afde7 --- /dev/null +++ b/content/references/examples/processing/isLooping_/isLooping_0.pde @@ -0,0 +1,21 @@ +void setup() { + size(200, 200); + noLoop(); +} + +void draw() { + background(204); + if (isLooping()) { + line(0, 0, width, height); + } else { + line(0, height, width, 0); + } +} + +void mousePressed() { + if (isLooping()) { + noLoop(); + } else { + loop(); + } +} diff --git a/content/references/translations/en/processing/isLooping_.json b/content/references/translations/en/processing/isLooping_.json new file mode 100644 index 000000000..2a6708585 --- /dev/null +++ b/content/references/translations/en/processing/isLooping_.json @@ -0,0 +1,12 @@ +{ + "brief": "Reports whether the sketch is continuously executing the code within draw()", + "related": ["loop_", "noLoop_", "draw_"], + "name": "isLooping()", + "description": "Returns true if Processing is continuously executing the code within draw(), and false after noLoop() has been called. Calling loop() resumes continuous execution and isLooping() will return true again.", + "syntax": ["isLooping()"], + "returns": "boolean", + "type": "function", + "category": "structure", + "subcategory": "", + "parameters": [] +} diff --git a/content/references/translations/en/processing/loop_.json b/content/references/translations/en/processing/loop_.json index ae2d0322a..adbe39a2d 100644 --- a/content/references/translations/en/processing/loop_.json +++ b/content/references/translations/en/processing/loop_.json @@ -1,6 +1,6 @@ { "brief": "Causes Processing to continuously execute the code within\n draw()", - "related": ["noLoop_", "redraw_", "draw_"], + "related": ["noLoop_", "isLooping_", "redraw_", "draw_"], "name": "loop()", "description": "By default, Processing loops through draw() continuously, executing\n the code within it. However, the draw() loop may be stopped by calling\n noLoop(). In that case, the draw() loop can be resumed with\n loop().", "syntax": ["loop()"], diff --git a/content/references/translations/en/processing/noLoop_.json b/content/references/translations/en/processing/noLoop_.json index d75048722..991301f54 100644 --- a/content/references/translations/en/processing/noLoop_.json +++ b/content/references/translations/en/processing/noLoop_.json @@ -1,6 +1,6 @@ { "brief": "Stops Processing from continuously executing the code within draw()", - "related": ["loop_", "redraw_", "draw_"], + "related": ["loop_", "isLooping_", "redraw_", "draw_"], "name": "noLoop()", "description": "Stops Processing from continuously executing the code within\n draw(). If loop() is called, the code in draw()\n begin to run continuously again. If using noLoop() in\n setup(), it should be the last line inside the block.\n

\n When noLoop() is used, it's not possible to manipulate or access\n the screen inside event handling functions such as mousePressed()\n or keyPressed(). Instead, use those functions to call\n redraw() or loop(), which will run draw(), which\n can update the screen properly. This means that when noLoop() has been\n called, no drawing can happen, and functions like saveFrame() or\n loadPixels() may not be used.\n

\n Note that if the sketch is resized, redraw() will be called to\n update the sketch, even after noLoop() has been specified.\n Otherwise, the sketch would enter an odd state until loop() was called.", "syntax": ["noLoop()"],