File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/content/tutorials/zh-Hans Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11---
2- title : " Repeating with Loops( 循环重复) "
2+ title : " 循环重复"
33description : " 使用循环和数组创建毛毛虫爬行比赛!"
44category : introduction
55categoryIndex : 5
@@ -20,11 +20,11 @@ import EditableSketch from "../../../components/EditableSketch/index.astro";
2020import Callout from " ../../../components/Callout/index.astro" ;
2121import AnnotatedLine from " ../../../components/AnnotatedLine/index.astro" ;
2222
23- ## Introduction(介绍)
23+ ## 介绍
2424
2525你是否想通过少量代码就绘制出许多形状,从而将你的项目提升到新的水平?想象绘制一排树、一叠书、彩虹的拱形,或者蜂巢的内部。为了创建由相同形状的多个版本组成的图形,我们不再只写单独的形状,而是进入循环和数组的奇妙世界。让我们学习如何用少量代码创建重复的图案吧!
2626
27- ![ 一个拱形和一个六边形垂直排列,标签为 “single object.( 单个对象) ” 箭头从这些形状指向下方垂直排列在 “multiplied objects.( 多个对象) ” 标签下的对应图案。单个拱形指向五个垂直堆叠、形成彩虹形状的拱形。六边形指向排列成蜂巢镶嵌图案的多个六边形。] ( ../images/introduction/loops-intro.png )
27+ ![ 一个拱形和一个六边形垂直排列,标签为 “单个对象” 箭头从这些形状指向下方垂直排列在 “多个对象” 标签下的对应图案。单个拱形指向五个垂直堆叠、形成彩虹形状的拱形。六边形指向排列成蜂巢镶嵌图案的多个六边形。] ( ../images/introduction/loops-intro.png )
2828
2929绘制每个形状都写一行新代码将会非常繁琐。相反的,我们可以使用 * loops* (循环),它允许我们执行并重复代码块任意次数。在本教程中,我们使用循环和数组来创建重复的可视化效果 [ 一个毛毛虫赛跑的草图] ( https://editor.p5js.org/gbenedis@gmail.com/sketches/BrmtZ36ET ) .
3030
@@ -164,7 +164,7 @@ function draw() {
164164` } / >
165165```
166166
167- ### [ If-statements(If 语句) ] ( /reference/p5/if )
167+ ### [ If 语句] ( /reference/p5/if )
168168
169169if 语句(如上面示例中使用的那样)表示:只有当某个条件为真时,才会执行对应的一段代码。它的通常写法如下:
170170
@@ -419,7 +419,7 @@ function drawCaterpillar() {
419419 - 在函数括号内添加 ` y ` 作为第二个参数: ` function drawCaterpillar(x,y) { ... } `
420420 - 在函数体中将 ` circY ` 替换为 ` y ` 。
421421
422- 你可以在之前的教程 [ 使用函数组织代码] ( /tutorials/zh-Hans/organizing-code-with-functions ) , 和 p5.js 的参考文档 [ functions ] ( /reference/p5/function ) 中了解更多关于自定义函数、参数和实参的信息。
422+ 你可以在之前的教程 [ 使用函数组织代码] ( /tutorials/zh-Hans/organizing-code-with-functions ) , 和 p5.js 的参考文档 [ 函数 ] ( /reference/p5/function ) 中了解更多关于自定义函数、参数和实参的信息。
423423
424424你的自定义函数现在应该类似于这样:
425425
You can’t perform that action at this time.
0 commit comments