File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,6 @@ p5.prototype._onblur = function(e) {
322
322
* <div><code>
323
323
* var x = 100;
324
324
* var y = 100;
325
- * var widthAndHeight = 50;
326
325
*
327
326
* function setup() {
328
327
* createCanvas(512, 512);
@@ -345,24 +344,39 @@ p5.prototype._onblur = function(e) {
345
344
* y += 5;
346
345
* }
347
346
*
347
+ * clear();
348
+ * fill(255, 0, 0);
349
+ * ellipse(x, y, 50, 50);
350
+ * }
351
+ * </code></div>
352
+ *
353
+ * <div><code>
354
+ * var diameter = 50;
355
+ *
356
+ * function setup() {
357
+ * createCanvas(512, 512);
358
+ * }
359
+ *
360
+ * function draw() {
348
361
* // 107 and 187 are keyCodes for "+"
349
362
* if (keyIsDown(107) || keyIsDown(187)) {
350
- * widthAndHeight += 1;
363
+ * diameter += 1;
351
364
* }
352
365
*
353
366
* // 109 and 189 are keyCodes for "-"
354
367
* if (keyIsDown(109) || keyIsDown(189)) {
355
- * widthAndHeight -= 1;
368
+ * diameter -= 1;
356
369
* }
357
370
*
358
371
* clear();
359
372
* fill(255, 0, 0);
360
- * ellipse(x, y, widthAndHeight, widthAndHeight );
373
+ * ellipse(50, 50, diameter, diameter );
361
374
* }
362
375
* </code></div>
363
376
*
364
377
* @alt
365
378
* 50x50 red ellipse moves left, right, up and down with arrow presses.
379
+ * 50x50 red ellipse gets bigger or smaller when + or - are pressed.
366
380
*
367
381
*/
368
382
p5 . prototype . keyIsDown = function ( code ) {
You can’t perform that action at this time.
0 commit comments