forked from processing/processing-web-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.xml
More file actions
executable file
·85 lines (58 loc) · 2.02 KB
/
Copy pathdraw.xml
File metadata and controls
executable file
·85 lines (58 loc) · 2.02 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>draw()</name>
<category>Structure</category>
<subcategory></subcategory>
<usage>Web & Application</usage>
<example>
<image></image>
<applet></applet>
<code><![CDATA[
float yPos = 0.0;
void setup() {
size(200, 200);
frameRate(30);
}
void draw() {
background(204);
yPos = yPos - 1.0;
if(yPos < 0) {
yPos = height;
}
line(0, yPos, width, yPos);
}
]]></code>
</example>
<example>
<image></image>
<applet></applet>
<code><![CDATA[
void setup() {
size(200, 200);
}
void draw() { }
void mousePressed() {
line(mouseX, 10, mouseX, 90);
}
]]></code>
</example>
<description><![CDATA[Called directly after <b>setup()</b> and continuously executes the lines of code contained inside its block until the program is stopped or <b>noLoop()</b> is called. The <b>draw()</b> function is called automatically and should never be called explicitly. It should always be controlled with <b>noLoop()</b>, <b>redraw()</b> and <b>loop()</b>. After <b>noLoop()</b> stops the code in <b>draw()</b> from executing, <b>redraw()</b> causes the code inside <b>draw()</b> to execute once and <b>loop()</b> will causes the code inside <b>draw()</b> to execute continuously again. The number of times <b>draw()</b> executes in each second may be controlled with the <b>delay()</b> and <b>frameRate()</b> functions. There can only be one <b>draw()</b> function for each sketch and <b>draw()</b> must exist if you want the code to run continuously or to process events such as <b>mousePressed()</b>. Sometimes, you might have an empty call to <b>draw()</b> in your program as shown in the above example. ]]></description>
<syntax><![CDATA[
draw() {
<kbd>statements</kbd>
}
]]></syntax>
<parameter>
<label>statements</label>
<description><![CDATA[A sequence of statements]]></description>
</parameter>
<returns>None</returns>
<related>
setup()
loop()
noLoop()
</related>
<availability>1.0</availability>
<type>Processing Function</type>
<partof>PDE</partof>
</root>