Skip to content

Commit 94aa9a6

Browse files
committed
resolve comments
1 parent 1c9853c commit 94aa9a6

File tree

4 files changed

+24
-40
lines changed

4 files changed

+24
-40
lines changed

src/data/examples/zh-Hans/07_Color/02_Brightness.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
let img;
1111

1212
function preload() {
13-
img = loadImage("assets/moonwalk.jpg");
13+
img = loadImage('assets/moonwalk.jpg');
1414
}
1515

1616
function setup() {
@@ -23,17 +23,17 @@ function setup() {
2323
function draw() {
2424
for (let x = 0; x < img.width; x++) {
2525
for (let y = 0; y < img.height; y++) {
26-
// 通过2D网格计算1D位置
26+
// 通过 2D 网格计算1D位置
2727
let loc = (x + y * img.width) * 4;
28-
// 从图像里获取R,G,B数值
28+
// 从图像里获取 R,G,B 数值
2929
let r, g, b;
3030
r = img.pixels[loc];
3131
// 根据距离光标的距离计算亮度改变的量
3232
let maxdist = 50;
3333
let d = dist(x, y, mouseX, mouseY);
3434
let adjustbrightness = (255 * (maxdist - d)) / maxdist;
3535
r += adjustbrightness;
36-
// 限制RGB以确保它们在0-255的颜色范围内
36+
// 限制 RGB 以确保它们在 0-255 的颜色范围内
3737
r = constrain(r, 0, 255);
3838
// 创建一个新颜色,并在窗口里设置像素
3939
//color c = color(r, g, b);

src/data/examples/zh-Hans/07_Color/03_Color_Variables.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* @name 颜色变量
3-
* @description (向Albers致敬。) 此范例为颜色们建立了变量。
3+
* @description (向 Albers 致敬。) 此范例为颜色们建立了变量。
44
* 这样它们可以在程序中以名字指代,而非数字。
55
*/
66
function setup() {
@@ -12,7 +12,7 @@ function setup() {
1212
let middle = color(204, 153, 0);
1313
let outside = color(153, 51, 0);
1414

15-
// 以下陈述与上面陈述的等效
15+
// 以下语句与上面的语句等效
1616
// 程序员可以选择他们喜欢的格式。
1717
//let inside = color('#CC6600');
1818
//let middle = color('#CC9900');

src/data/examples/zh-Hans/07_Color/05_Linear_Gradient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* @name 线性渐变
3-
* @description lerpColor()函数可用于在两个颜色之间插值。
3+
* @description lerpColor() 函数可用于在两个颜色之间插值。
44
*/
55
// 常量
66
const Y_AXIS = 1;

src/data/examples/zh-Hans/07_Color/07_Lerp_Color.js

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @name Lerp Color
2+
* @name 插值颜色
33
* @description 随机循环形状,颜色从红色到蓝色。
44
*/
55
function setup() {
@@ -17,47 +17,31 @@ function draw() {
1717
for (let i = 0; i < 15; i++) {
1818
fill(from);
1919
quad(
20-
random(-40, 220),
21-
random(height),
22-
random(-40, 220),
23-
random(height),
24-
random(-40, 220),
25-
random(height),
26-
random(-40, 220),
27-
random(height)
20+
random(-40, 220), random(height),
21+
random(-40, 220), random(height),
22+
random(-40, 220), random(height),
23+
random(-40, 220), random(height)
2824
);
2925
fill(c1);
3026
quad(
31-
random(140, 380),
32-
random(height),
33-
random(140, 380),
34-
random(height),
35-
random(140, 380),
36-
random(height),
37-
random(140, 380),
38-
random(height)
27+
random(140, 380), random(height),
28+
random(140, 380), random(height),
29+
random(140, 380), random(height),
30+
random(140, 380), random(height)
3931
);
4032
fill(c2);
4133
quad(
42-
random(320, 580),
43-
random(height),
44-
random(320, 580),
45-
random(height),
46-
random(320, 580),
47-
random(height),
48-
random(320, 580),
49-
random(height)
34+
random(320, 580), random(height),
35+
random(320, 580), random(height),
36+
random(320, 580), random(height),
37+
random(320, 580), random(height)
5038
);
5139
fill(to);
5240
quad(
53-
random(500, 760),
54-
random(height),
55-
random(500, 760),
56-
random(height),
57-
random(500, 760),
58-
random(height),
59-
random(500, 760),
60-
random(height)
41+
random(500, 760), random(height),
42+
random(500, 760), random(height),
43+
random(500, 760), random(height),
44+
random(500, 760), random(height)
6145
);
6246
}
6347
frameRate(5);

0 commit comments

Comments
 (0)