@@ -14,22 +14,59 @@ define(function (require) {
1414 throw 'exit() not implemented, see remove()' ;
1515 } ;
1616 /**
17- * Stops p5.js from continuously executing the code within draw(). If loop()
18- * is called, the code in draw() begins to run continuously again. If using
19- * noLoop() in setup(), it should be the last line inside the block.
17+ * <p>Stops p5.js from continuously executing the code within draw().
18+ * If loop() is called, the code in draw() begins to run continuously again.
19+ * If using noLoop() in setup(), it should be the last line inside the block.
20+ * </p>
2021 *
21- * When noLoop() is used, it's not possible to manipulate or access the
22+ * <p> When noLoop() is used, it's not possible to manipulate or access the
2223 * screen inside event handling functions such as mousePressed() or
2324 * keyPressed(). Instead, use those functions to call redraw() or loop(),
2425 * which will run draw(), which can update the screen properly. This means
2526 * that when noLoop() has been called, no drawing can happen, and functions
26- * like saveFrame() or loadPixels() may not be used.
27+ * like saveFrame() or loadPixels() may not be used.</p>
2728 *
28- * Note that if the sketch is resized, redraw() will be called to update the
29- * sketch, even after noLoop() has been specified. Otherwise, the sketch
30- * would enter an odd state until loop() was called.
29+ * <p> Note that if the sketch is resized, redraw() will be called to update
30+ * the sketch, even after noLoop() has been specified. Otherwise, the sketch
31+ * would enter an odd state until loop() was called.</p>
3132 *
3233 * @method noLoop
34+ * @example
35+ * <div><code>
36+ * function setup() {
37+ * createCanvas(100, 100);
38+ * background(200);
39+ * noLoop();
40+ * }
41+
42+ * function draw() {
43+ * line(10, 10, 90, 90);
44+ * }
45+ * </code></div>
46+ *
47+ * <div><code>
48+ * var x = 0;
49+ * function setup() {
50+ * createCanvas(100, 100);
51+ * }
52+ *
53+ * function draw() {
54+ * background(204);
55+ * x = x + 0.1;
56+ * if (x > width) {
57+ * x = 0;
58+ * }
59+ * line(x, 0, x, height);
60+ * }
61+ *
62+ * function mousePressed() {
63+ * noLoop();
64+ * }
65+ *
66+ * function mouseReleased() {
67+ * loop();
68+ * }
69+ * </code></div>
3370 */
3471 p5 . prototype . noLoop = function ( ) {
3572 this . _loop = false ;
0 commit comments