Skip to content

Commit 330a136

Browse files
committed
examples: Remove prefix
Signed-off-by: Ce Gao <[email protected]>
1 parent 23c2fc2 commit 330a136

File tree

23 files changed

+108
-108
lines changed

23 files changed

+108
-108
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
processing$background(255, 204, 0)
1+
background(255, 204, 0)
22

3-
processing$line(11, 22, 33, 22)
3+
line(11, 22, 33, 22)
44

5-
processing$arc(50, 55, 50, 50, 0, 100)
5+
arc(50, 55, 50, 50, 0, 100)
66

7-
processing$triangle(30, 75, 58, 20, 86, 75)
7+
triangle(30, 75, 58, 20, 86, 75)
88

9-
processing$ellipse(56, 46, 55, 55)
9+
ellipse(56, 46, 55, 55)
1010

11-
processing$quad(38, 31, 86, 20, 69, 63, 30, 76)
11+
quad(38, 31, 86, 20, 69, 63, 30, 76)
1212

13-
processing$bezierDetail(as.integer(12))
13+
bezierDetail(as.integer(12))
1414

15-
processing$bezier(85, 20, 10, 10, 90, 90, 15, 80)
15+
bezier(85, 20, 10, 10, 90, 90, 15, 80)
1616

17-
# for (i in 1:16) { t = i / float(steps); x = processing$bezierPoint(85, 10, 90,
18-
# 15, t); y = processing$bezierPoint(20, 10, 90, 80, t); tx =
19-
# processing$bezierTangent(85, 10, 90, 15, t); ty = processing$bezierTangent(20,
17+
# for (i in 1:16) { t = i / float(steps); x = bezierPoint(85, 10, 90,
18+
# 15, t); y = bezierPoint(20, 10, 90, 80, t); tx =
19+
# bezierTangent(85, 10, 90, 15, t); ty = bezierTangent(20,
2020
# 10, 90, 80, t); a = atan2(ty, tx); a -= HALF_PI; line(x, y, cos(a)*8 + x,
2121
# sin(a)*8 + y); }
2222

2323
# bezierPoint
2424
for (i in 1:10) {
2525
t = i/10
26-
x = processing$bezierPoint(85, 10, 90, 15, t)
27-
y = processing$bezierPoint(20, 10, 90, 80, t)
28-
processing$ellipse(x, y, 5, 5)
26+
x = bezierPoint(85, 10, 90, 15, t)
27+
y = bezierPoint(20, 10, 90, 80, t)
28+
ellipse(x, y, 5, 5)
2929
}
3030

31-
processing$curve(5, 26, 73, 24, 73, 61, 15, 65)
31+
curve(5, 26, 73, 24, 73, 61, 15, 65)
3232

3333
stdout$print("Hello, Processing.R")

examples/Basics/Draw/Draw.rpde

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
yPos <- 0
22

33
draw <- function() {
4-
processing$background(as.integer(204))
4+
background(as.integer(204))
55
yPos <- yPos - 1
66
if (yPos < 0) {
77
yPos <- height
88
}
9-
processing$line(0, yPos, width, yPos)
9+
line(0, yPos, width, yPos)
1010
}

examples/Basics/ObjectOrientedProgramming/ObjectOrientedProgramming.rpde

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ display <- function(cell) {
2424
}
2525

2626
display.Cell <- function(cell) {
27-
processing$stroke(255)
28-
processing$fill(127 + 127 * sin(cell$angle))
29-
processing$rect(cell$x, cell$y, cell$w, cell$h)
27+
stroke(255)
28+
fill(127 + 127 * sin(cell$angle))
29+
rect(cell$x, cell$y, cell$w, cell$h)
3030
}
3131

3232
grid <- list()
3333

3434
settings <- function() {
3535
stdout$print("Set width and height.")
36-
processing$size(200, 200)
36+
size(200, 200)
3737
}
3838

3939
setup <- function() {
@@ -46,7 +46,7 @@ setup <- function() {
4646
}
4747

4848
draw <- function() {
49-
processing$background(0)
49+
background(0)
5050
for (i in 1:cols - 1) {
5151
for (j in 1:rows - 1) {
5252
oscillate(grid[[1 + i * cols + j]])

examples/Basics/Settings/Settings.rpde

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ yPos <- 0
22

33
settings <- function() {
44
stdout$print("Set width and height.")
5-
processing$size(500, 500)
5+
size(500, 500)
66
}
77

88
draw <- function() {
9-
processing$background(as.integer(204))
9+
background(as.integer(204))
1010
yPos <- yPos - 1
1111
if (yPos < 0) {
1212
yPos <- height
1313
}
14-
processing$line(0, yPos, width, yPos)
14+
line(0, yPos, width, yPos)
1515
}

examples/Basics/Setup/Setup.rpde

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
setup <- function() {
2-
processing$line(11, 22, 33, 22)
2+
line(11, 22, 33, 22)
33
stdout$print("Hello, Processing.R")
44
}

examples/Basics/ThreeDimensionalCube/ThreeDimensionalCube.rpde

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
PI <- 3.1415
22

33
settings <- function() {
4-
processing$size(500, 500, "processing.opengl.PGraphics3D")
4+
size(500, 500, "processing.opengl.PGraphics3D")
55
}
66

77
setup <- function() {
8-
processing$colorMode(as.integer(1), 1)
9-
processing$frameRate(24)
8+
colorMode(as.integer(1), 1)
9+
frameRate(24)
1010
}
1111

1212
draw <- function() {
1313
frames <- 24 * 3
14-
t <- processing$frameCount()/frames
14+
t <- frameCount()/frames
1515

16-
processing$background(1)
16+
background(1)
1717

18-
processing$perspective(0.5, 1, 0.01, 100)
18+
perspective(0.5, 1, 0.01, 100)
1919

20-
processing$camera(0, 0, 25 + sin(PI * 2 * t) * 3, 0, 0, 0, 0, 1, 0)
20+
camera(0, 0, 25 + sin(PI * 2 * t) * 3, 0, 0, 0, 0, 1, 0)
2121

22-
processing$rotateX(-0.5 - 0.05 * sin(PI * 4 * t))
23-
processing$rotateY(-0.5 - 0.05 * cos(PI * 2 * t))
22+
rotateX(-0.5 - 0.05 * sin(PI * 4 * t))
23+
rotateY(-0.5 - 0.05 * cos(PI * 2 * t))
2424

2525
columns <- 8
2626
for (ix in 1:columns - 1) {
@@ -33,10 +33,10 @@ draw <- function() {
3333
d <- sqrt(x * x + y * y + z * z)
3434
s <- abs(sin(d - t * 4 * PI))
3535

36-
processing$pushMatrix()
37-
processing$translate(x, z, y)
38-
processing$box(s)
39-
processing$popMatrix()
36+
pushMatrix()
37+
translate(x, z, y)
38+
box(s)
39+
popMatrix()
4040
}
4141
}
4242
}

examples/Basics/Trigonometry/trigonometry.rpde

+21-21
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,39 @@ frequency <- 2
1313
frequency2 <- 2
1414

1515
settings <- function() {
16-
processing$size(600, 200)
16+
size(600, 200)
1717
}
1818

1919
draw <- function() {
20-
processing$background(127)
21-
processing$noStroke()
22-
processing$fill(255)
23-
processing$ellipse(width/8, 75, radius * 2, radius * 2)
20+
background(127)
21+
noStroke()
22+
fill(255)
23+
ellipse(width/8, 75, radius * 2, radius * 2)
2424
# Rotates rectangle around circle
25-
px <- width/8 + cos(processing$radians(angle)) * (radius)
26-
py <- 75 + sin(processing$radians(angle)) * (radius)
27-
processing$fill(0)
25+
px <- width/8 + cos(radians(angle)) * (radius)
26+
py <- 75 + sin(radians(angle)) * (radius)
27+
fill(0)
2828

29-
processing$rect(px, py, 5, 5)
30-
processing$stroke(100)
31-
processing$line(width/8, 75, px, py)
32-
processing$stroke(200)
29+
rect(px, py, 5, 5)
30+
stroke(100)
31+
line(width/8, 75, px, py)
32+
stroke(200)
3333

3434
# Keep reinitializing to 0, to avoid Flashing during redrawing
3535
angle2 <- 0
3636

3737
# Draw static curve - y <- sin(x)
3838
for (i in 1:width - 1) {
39-
px2 <- width/8 + cos(processing$radians(angle2)) * (radius)
40-
py2 <- 75 + sin(processing$radians(angle2)) * (radius)
41-
processing$point(width/8 + radius + i, py2)
39+
px2 <- width/8 + cos(radians(angle2)) * (radius)
40+
py2 <- 75 + sin(radians(angle2)) * (radius)
41+
point(width/8 + radius + i, py2)
4242
angle2 <- angle2 - frequency2
4343
}
4444

4545
# Send small ellipse along sine curve to illustrate relationship of circle to
4646
# wave
47-
processing$noStroke()
48-
processing$ellipse(width/8 + radius + x, py, 5, 5)
47+
noStroke()
48+
ellipse(width/8 + radius + x, py, 5, 5)
4949
angle <- angle - frequency
5050
x <- x + 1
5151

@@ -56,10 +56,10 @@ draw <- function() {
5656
}
5757

5858
# Draw dynamic line connecting circular path with wave
59-
processing$stroke(50)
60-
processing$line(px, py, width/8 + radius + x, py)
59+
stroke(50)
60+
line(px, py, width/8 + radius + x, py)
6161

62-
# Output calculations to screen processing$text('y <- sin x', 35, 185)
63-
# processing$text('px <- ' + px, 105, 185) processing$text('py <- ' + py, 215,
62+
# Output calculations to screen text('y <- sin x', 35, 185)
63+
# text('px <- ' + px, 105, 185) text('py <- ' + py, 215,
6464
# 185)
6565
}

examples/reference/arc/arc1/arc1.rpde

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ HALF_PI <- PI/2
33
QUARTER_PI <- PI/4
44
TWO_PI <- PI * 2
55

6-
processing$arc(50, 55, 50, 50, 0, HALF_PI)
7-
processing$noFill()
8-
processing$arc(50, 55, 60, 60, HALF_PI, PI)
9-
processing$arc(50, 55, 70, 70, PI, PI + QUARTER_PI)
10-
processing$arc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI)
6+
arc(50, 55, 50, 50, 0, HALF_PI)
7+
noFill()
8+
arc(50, 55, 60, 60, HALF_PI, PI)
9+
arc(50, 55, 70, 70, PI, PI + QUARTER_PI)
10+
arc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI)

examples/reference/arc/arc2/arc2.rpde

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ CHORD <- 2
55
PIE <- 3
66

77
# TODO: Fix double to int cast.
8-
processing$arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(OPEN))
8+
arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(OPEN))

examples/reference/arc/arc3/arc3.rpde

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ OPEN <- 1
44
CHORD <- 2
55
PIE <- 3
66

7-
processing$arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(CHORD))
7+
arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(CHORD))

examples/reference/arc/arc4/arc4.rpde

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ OPEN <- 1
44
CHORD <- 2
55
PIE <- 3
66

7-
processing$arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(PIE))
7+
arc(50, 50, 80, 80, 0, PI + QUARTER_PI, as.integer(PIE))

examples/reference/box/box1/box1.rpde

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
P3D <- "processing.opengl.PGraphics3D"
22

33
settings <- function() {
4-
processing$size(100, 100, P3D)
4+
size(100, 100, P3D)
55
}
66

77
setup <- function() {
8-
processing$noLoop()
8+
noLoop()
99
}
1010

1111
draw <- function() {
12-
processing$translate(58, 48, 0)
13-
processing$rotateY(0.5)
14-
processing$noFill()
15-
processing$box(40)
12+
translate(58, 48, 0)
13+
rotateY(0.5)
14+
noFill()
15+
box(40)
1616
}

examples/reference/box/box2/box2.rpde

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
P3D <- "processing.opengl.PGraphics3D"
22

33
settings <- function() {
4-
processing$size(100, 100, P3D)
4+
size(100, 100, P3D)
55
}
66

77
setup <- function() {
8-
processing$noLoop()
8+
noLoop()
99
}
1010

1111
draw <- function() {
12-
processing$translate(58, 48, 0)
13-
processing$rotateY(0.5)
14-
processing$noFill()
15-
processing$box(40, 20, 50)
12+
translate(58, 48, 0)
13+
rotateY(0.5)
14+
noFill()
15+
box(40, 20, 50)
1616
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
processing$ellipse(56, 46, 55, 55)
1+
ellipse(56, 46, 55, 55)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
processing$line(30, 20, 85, 75)
1+
line(30, 20, 85, 75)
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
processing$line(30, 20, 85, 20)
2-
processing$stroke(126)
3-
processing$line(85, 20, 85, 75)
4-
processing$stroke(255)
5-
processing$line(85, 75, 30, 75)
1+
line(30, 20, 85, 20)
2+
stroke(126)
3+
line(85, 20, 85, 75)
4+
stroke(255)
5+
line(85, 75, 30, 75)

examples/reference/line/line3/line3.rpde

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
P3D <- "processing.opengl.PGraphics3D"
44

55
settings <- function() {
6-
processing$size(100, 100, P3D)
6+
size(100, 100, P3D)
77
}
88

99
setup <- function() {
1010
}
1111

1212
draw <- function() {
13-
processing$line(30, 20, 0, 85, 20, 15)
14-
processing$stroke(126)
15-
processing$line(85, 20, 15, 85, 75, 0)
16-
processing$stroke(255)
17-
processing$line(85, 75, 0, 30, 75, -50)
13+
line(30, 20, 0, 85, 20, 15)
14+
stroke(126)
15+
line(85, 20, 15, 85, 75, 0)
16+
stroke(255)
17+
line(85, 75, 0, 30, 75, -50)
1818
}
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# point 1 https://processing.org/reference/point_.html
22

3-
processing$noSmooth()
4-
processing$point(30, 20)
5-
processing$point(85, 20)
6-
processing$point(85, 75)
7-
processing$point(30, 75)
3+
noSmooth()
4+
point(30, 20)
5+
point(85, 20)
6+
point(85, 75)
7+
point(30, 75)

examples/reference/point/point2/point2.rpde

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
P3D <- "processing.opengl.PGraphics3D"
44
settings <- function() {
5-
processing$size(100, 100, P3D)
5+
size(100, 100, P3D)
66
}
77

88
draw <- function() {
9-
processing$noSmooth()
10-
processing$point(30, 20, -50)
11-
processing$point(85, 20, -50)
12-
processing$point(85, 75, -50)
13-
processing$point(30, 75, -50)
9+
noSmooth()
10+
point(30, 20, -50)
11+
point(85, 20, -50)
12+
point(85, 75, -50)
13+
point(30, 75, -50)
1414
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
processing$quad(38, 31, 86, 20, 69, 63, 30, 76)
1+
quad(38, 31, 86, 20, 69, 63, 30, 76)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
processing$rect(30, 20, 55, 55)
1+
rect(30, 20, 55, 55)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
processing$rect(30, 20, 55, 55, 7)
1+
rect(30, 20, 55, 55, 7)

0 commit comments

Comments
 (0)