noLoop: Stop draw() from looping.

Description Usage Arguments Examples

Description

Stop draw() from looping.

Usage

1

Arguments

sketch

A p5 sketch.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
# Click the resulting sketch

pre_ <- pre() %>%
  js("var x = 0;")
setup_ <- setup() %>%
  createCanvas(100, 100)
draw_ <- draw() %>%
  background("#F0F8FF") %>%
  js(" x = x + 0.1;
       if (x > width) {
         x = 0;
       } ") %>%
   line(~x, 0, ~x, ~height)
post_ <- post() %>%
  js(" mousePressed = function() {
         noLoop();
       }

       mouseReleased = function() {
         loop();
       } ")
sketch(pre = pre_, setup = setup_, draw = draw_, post = post_)

## End(Not run)

seankross/p5 documentation built on May 30, 2019, 8:17 a.m.