Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions content/references/examples/processing/isLooping_/isLooping_0.pde
Original file line number Diff line number Diff line change
@@ -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();
}
}
12 changes: 12 additions & 0 deletions content/references/translations/en/processing/isLooping_.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the _.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"brief": "Reports whether the sketch is continuously executing the code within <b>draw()</b>",
"related": ["loop_", "noLoop_", "draw_"],
"name": "isLooping()",
"description": "Returns <b>true</b> if Processing is continuously executing the code within <b>draw()</b>, and <b>false</b> after <b>noLoop()</b> has been called. Calling <b>loop()</b> resumes continuous execution and <b>isLooping()</b> will return <b>true</b> again.",
"syntax": ["isLooping()"],
"returns": "boolean",
"type": "function",
"category": "structure",
"subcategory": "",
"parameters": []
}
2 changes: 1 addition & 1 deletion content/references/translations/en/processing/loop_.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"brief": "Causes Processing to continuously execute the code within\n <b>draw()</b>",
"related": ["noLoop_", "redraw_", "draw_"],
"related": ["noLoop_", "isLooping_", "redraw_", "draw_"],
"name": "loop()",
"description": "By default, Processing loops through <b>draw()</b> continuously, executing\n the code within it. However, the <b>draw()</b> loop may be stopped by calling\n <b>noLoop()</b>. In that case, the <b>draw()</b> loop can be resumed with\n <b>loop()</b>.",
"syntax": ["loop()"],
Expand Down
2 changes: 1 addition & 1 deletion content/references/translations/en/processing/noLoop_.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"brief": "Stops Processing from continuously executing the code within <b>draw()</b>",
"related": ["loop_", "redraw_", "draw_"],
"related": ["loop_", "isLooping_", "redraw_", "draw_"],
"name": "noLoop()",
"description": "Stops Processing from continuously executing the code within\n <b>draw()</b>. If <b>loop()</b> is called, the code in <b>draw()</b>\n begin to run continuously again. If using <b>noLoop()</b> in\n <b>setup()</b>, it should be the last line inside the block.\n <br/> <br/>\n When <b>noLoop()</b> is used, it's not possible to manipulate or access\n the screen inside event handling functions such as <b>mousePressed()</b>\n or <b>keyPressed()</b>. Instead, use those functions to call\n <b>redraw()</b> or <b>loop()</b>, which will run <b>draw()</b>, 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 <br/> <br/>\n Note that if the sketch is resized, <b>redraw()</b> will be called to\n update the sketch, even after <b>noLoop()</b> has been specified.\n Otherwise, the sketch would enter an odd state until <b>loop()</b> was called.",
"syntax": ["noLoop()"],
Expand Down