MCPcopy Create free account
hub / github.com/processing/p5.js / draw

Function draw

test/manual-test-examples/learningprocessing/chp7/example_7_5.js:20–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18}
19
20function draw() {
21 background(255); // Draw a black background
22
23 // mouseX position determines speed factor for moveZoog function
24 var factor = constrain(mouseX / 10, 0, 5);
25
26 // The code for changing the variables associated with Zoog and displaying Zoog is moved outside of draw() and into functions called here.
27 // The functions are given arguments, such as “Jiggle Zoog by the following factor” and “draw Zoog with the following eye color.
28 jiggleZoog(factor);
29 // pass in a color to drawZoog
30 // function for eye's color
31 var d = dist(x, y, mouseX, mouseY);
32 var c = color(d);
33 drawZoog(c);
34}
35
36function jiggleZoog(speed) {
37 // Change the x and y location of Zoog randomly

Callers

nothing calls this directly

Calls 4

constrainFunction · 0.85
jiggleZoogFunction · 0.85
colorFunction · 0.85
drawZoogFunction · 0.85

Tested by

no test coverage detected