复习:第 6 课 5 分钟
- 星星就是箭头绕了不止一圈的图形。
- 最尖的星星转 180 − (180 ÷ 角数)。
- 循环里的颜色变化,让每条线都有自己的颜色。
快问快答
你的多边形积木让箭头转了一整圈。最后它面向哪边?
看答案
和开始时一样的方向。360 度就是整整一圈。今天这一点很重要:它说明下一个图形会从一个我们知道的方向开始。
今天的主题 3 分钟
- 画一个图形,转一点,再画一次
- 份数规则:份数 × 转向 = 360
- 一个用到你的多边形积木的
flower (petals) (sides) (size) :: custom积木 - 拿掉等待,因为画得太慢了
学习目标
学完这一课,你会:
- 把一个图形重复画,中间转一下,做出图案。
- 算出让图案封口的转向。
- 做一个会调用另一个自制积木的自制积木。
学一学:绕一整圈的图案 28 分钟
1 · 一片花瓣,然后十二片
从舞台中间画一个六边形。箭头最后面向它开始时的方向。把它转 30 度,再画一次六边形。这样做十二次。
repeat (12)
polygon (6) (45) :: custom
turn cw (30) degrees
change pen (color v) by (8)
end
怎么用: 点绿旗。先画一片花瓣,箭头会说出来,然后另外十一片接着画。
2 · 份数规则
转向加起来正好是一整圈时,图案就封口了。所以:份数 × 转向 = 360,也就是转向 = 360 ÷ 份数。这又是 360 规则——只是这一次说的是整个图形,而不是边。
| 份数 | 中间转多少度 |
|---|---|
| 4 | 360 ÷ 4 = 90 |
| 6 | 360 ÷ 6 = 60 |
| 8 | 360 ÷ 8 = 45 |
| 12 | 360 ÷ 12 = 30 |
怎么用: 点绿旗。三个图案:4 个正方形、6 个三角形、8 个五边形。看 copies 和 turn。
3 · 花朵积木
把这个图案包进一个有三个输入的积木里。在它里面,它调用你的多边形积木——一个积木可以用另一个积木。
define flower (petals) (sides) (size)
repeat (petals)
polygon (sides) (size) :: custom
turn cw ((360) / (petals)) degrees
change pen (color v) by ((100) / (petals))
end
基础任务:一朵彩虹花 24 分钟
打开你的作品。留着多边形积木。
第 1 步:让多边形画得快一点
- 找到你的 define polygon 帽子积木。
- 把
wait (0.1) seconds从里面拖出来,删掉。
第 2 步:花朵积木
- 制作一个叫
flower的积木,有三个输入:petals、sides和size。 - 在里面放:
repeat (petals)。 - 在 repeat 里面:
polygon (sides) (size) :: custom,然后是转向,再然后是颜色变化。
第 3 步:画出来
- 在绿旗下面放:
erase all、画笔粗细 2、一种画笔颜色。 - 走到 x: 0,y: 0,面向 90。
flower (12) (6) (45) :: custom。
define polygon (sides) (size)
repeat (sides)
move (size) steps
turn cw ((360) / (sides)) degrees
end
define flower (petals) (sides) (size)
repeat (petals)
polygon (sides) (size) :: custom
turn cw ((360) / (petals)) degrees
change pen (color v) by ((100) / (petals))
end
when flag clicked
erase all
set pen size to (2)
set pen color to [#ff4fa3]
pen up
go to x: (0) y: (0)
point in direction (90)
pen down
flower (12) (6) (45) :: custom
怎么用: 点绿旗,看花一片花瓣一片花瓣地长出来。
我的花有一个缺口。
转向错了。必须是 360 ÷ 花瓣数。12 片花瓣就是 30。
我的花瓣散得满舞台都是。
循环里面有一个 go to x: (0) y: (0)。在花开始画之前,只走过去一次。
画得特别慢。
等待还在多边形积木里面。把它拿掉。
三朵花
一个积木,三朵很不一样的花。
- 左上:8 个正方形。
- 中下:10 个五边形。
- 右上:16 个三角形。
- 每朵花都从自己的颜色开始,而且都放得进舞台。
怎么用: 点绿旗。三朵花一朵接一朵地画出来。
Teacher reveal
flower (8) (4) (35) :: custom
flower (10) (5) (28) :: custom
flower (16) (3) (52) :: custom
Each call needs its own travel first — centres at (-150, 55), (0, -45) and (150, 55).
曼陀罗
在同一个中心叠三朵花,做出一个曼陀罗——一种圆形的、不断重复的图案。
- 三朵花共用同一个中心。
- 最大的先画,最小的最后画。
- 每一层都是不同的颜色。
怎么用: 点绿旗。先是大的蓝色层,然后是粉色,再然后是黄色。
Teacher reveal
flower (8) (4) (68) :: custom
flower (12) (6) (30) :: custom
flower (6) (3) (26) :: custom
Each layer needs a go to x: (0) y: (10) and point in direction (90) before it. The flower block leaves the arrow facing the right way, but setting it again makes the layers line up even if a pupil’s numbers do not add up to 360.
星星组成的花
用上一课的星星积木当花瓣。
- 八颗五角星,全都从中心开始。
- 图案封口。
- 每两颗星星之间,颜色往前变。
怎么用: 点绿旗,一边画一边数星星。
Teacher reveal
repeat (8)
star (5) (80) :: custom
turn cw (45) degrees
change pen (color v) by (12)
end
The star block from Lesson 6 has a wait in it. Pupils who leave it in get a slow but correct pattern — a good moment to ask why the flower block took it out of polygon.
种一个花园
点舞台,种一朵花。每朵花都是一个惊喜。
- 点绿旗清空画板,种下一朵花。
- 每点一下,就在你点的地方种一朵花。
- 每朵花自己选花瓣数(5 到 12)、边数(3 到 6)、大小和颜色。
怎么用: 点绿旗,然后在舞台上任意地方点一下,种一朵花。
Teacher reveal
when stage clicked
pen up
go to x: (mouse x) y: (mouse y)
point in direction (90)
pen down
set pen (color v) to (pick random (0) to (100))
flower (pick random (5) to (12)) (pick random (3) to (6)) (pick random (15) to (32)) :: custom
pen up
总结 5 分钟
- 画一个图形,转一下,再画一次——这就是图案。
- 份数 × 转向 = 360 时,图案就封口了。
- 一个自制积木可以调用另一个自制积木。
- Scratch 的颜色从 0 到 100。每次改变 100 ÷ 花瓣数,就正好绕一圈。
- 旋转对称
- 把图案转过一部分以后,看起来还是一样。
- 花瓣
- 花朵图案里,那个图形的一份。
- 曼陀罗
- 一种圆形图案,由绕着中心重复的好几层组成。
交作业
保存你的花园。下一课,这些数会搬到键盘上,你的作品会变成一台图案机器。