Skip to content

Commit 46f611e

Browse files
committed
docs: Update
Signed-off-by: Ce Gao <ce.gao@outlook.com>
1 parent 1c5d1f7 commit 46f611e

13 files changed

+201
-4
lines changed

docs/createShape.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,95 @@
3838
<td><h3>createShape</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre>settings &lt;- function() {
43+
size(100, 100)
44+
}
45+
46+
setup &lt;- function() {
47+
# Creating the PShape as a square. The numeric arguments are similar to rect().
48+
s = createShape()
49+
s$beginShape(TRIANGLE_STRIP)
50+
s$vertex(30, 75)
51+
s$vertex(40, 20)
52+
s$vertex(50, 75)
53+
s$vertex(60, 20)
54+
s$vertex(70, 75)
55+
s$vertex(80, 20)
56+
s$vertex(90, 75)
57+
s$endShape()
58+
}
59+
60+
draw &lt;- function() {
61+
shape(s, 0, 0)
62+
}
63+
</pre>
64+
</div>
65+
<div class="example"> <pre>settings &lt;- function() {
66+
size(1000, 1000)
67+
}
68+
69+
setup &lt;- function() {
70+
# Create the shape group
71+
alien = createShape(GROUP)
72+
73+
# Make two shapes
74+
head = createShape(ELLIPSE, -25, 0, 50, 50)
75+
head$setFill(color(255))
76+
body = createShape(RECT, -25, 45, 50, 40)
77+
body$setFill(color(0))
78+
79+
# Add the two &#39;child&#39; shapes to the parent group
80+
alien$addChild(body)
81+
alien$addChild(head)
82+
}
83+
84+
draw &lt;- function() {
85+
background(204)
86+
translate(50, 15)
87+
shape(alien)
88+
}
89+
</pre>
90+
</div>
91+
<div class="example"> <pre>settings &lt;- function() {
92+
size(100, 100)
93+
}
94+
95+
setup &lt;- function() {
96+
# Creating the PShape as a square. The numeric arguments are similar to rect().
97+
s = createShape()
98+
s$beginShape()
99+
s$fill(0, 0, 255)
100+
s$noStroke()
101+
s$vertex(0, 0)
102+
s$vertex(0, 50)
103+
s$vertex(50, 50)
104+
s$vertex(50, 0)
105+
s$endShape(CLOSE)
106+
}
107+
108+
draw &lt;- function() {
109+
shape(s, 25, 25)
110+
}
111+
</pre>
112+
</div>
113+
<div class="example"> <pre>settings &lt;- function() {
114+
size(100, 100)
115+
}
116+
117+
setup &lt;- function() {
118+
# Creating the PShape as a square. The numeric arguments are similar to rect().
119+
square = createShape(RECT, 0, 0, 50, 50)
120+
square$setFill(color(0, 0, 255))
121+
square$setStroke(FALSE)
122+
}
123+
124+
draw &lt;- function() {
125+
shape(square, 25, 25)
126+
}
127+
</pre>
128+
</div>
129+
</tr>
41130

42131
<tr class="">
43132
<th scope="row">Description</th>

docs/cursor.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
<td><h3>cursor</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># Move the mouse left and right across the image to see the cursor change from a
43+
# cross to a hand
44+
45+
draw &lt;- function() {
46+
if (mouseX &lt; 50) {
47+
cursor(CROSS)
48+
} else {
49+
cursor(HAND)
50+
}
51+
}
52+
</pre>
53+
</div>
54+
</tr>
4155

4256
<tr class="">
4357
<th scope="row">Description</th>

docs/frameRate.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@
3838
<td><h3>frameRate</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre>setup &lt;- function() {
43+
frameRate(30)
44+
}
45+
46+
draw &lt;- function() {
47+
line(0, 0, width, height)
48+
println(frameCount)
49+
}
50+
</pre>
51+
</div>
52+
</tr>
4153

4254
<tr class="">
4355
<th scope="row">Description</th>

docs/height.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@
3838
<td><h3>height</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <img src="img/height1.png"/>
43+
<pre class='margin'>noStroke()
44+
background(0)
45+
rect(40, 0, 20, height)
46+
rect(60, 0, 20, height/2)
47+
</pre>
48+
</div>
49+
</tr>
4150

4251
<tr class="">
4352
<th scope="row">Description</th>
@@ -46,7 +55,7 @@
4655
</td>
4756
</tr>
4857

49-
<tr class=""><th scope="row">Syntax</th><td><pre> rect(40, 0, 20, height)</pre></td></tr>
58+
<tr class=""><th scope="row">Syntax</th><td><pre>rect(40, 0, 20, height)</pre></td></tr>
5059

5160

5261

docs/img/height1.png

219 Bytes
Loading

docs/img/rotateX1.png

407 Bytes
Loading

docs/img/rotateY1.png

379 Bytes
Loading

docs/img/rotateZ1.png

714 Bytes
Loading

docs/rotateX.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
}
5252
</pre>
5353
</div>
54-
<div class="example"> <pre>settings &lt;- function() {
54+
<div class="example"> <img src="img/rotateX1.png"/>
55+
<pre class='margin'>settings &lt;- function() {
5556
size(100, 100, P3D)
5657
}
5758

docs/rotateY.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
}
5252
</pre>
5353
</div>
54-
<div class="example"> <pre>settings &lt;- function() {
54+
<div class="example"> <img src="img/rotateY1.png"/>
55+
<pre class='margin'>settings &lt;- function() {
5556
size(100, 100, P3D)
5657
}
5758

0 commit comments

Comments
 (0)