0

如何将 HEX 代码放入可汗学院的 JavaScript 中?我想让它成为填充颜色,但我找不到正确的命令。我尝试了很多人们也尝试过的东西,但似乎都没有在可汗学院工作。请帮忙。

4

1 回答 1

0

您必须将十六进制转换为十进制。使用 KA 上的颜色功能,您将拥有三个由逗号分隔的十进制数字,表示十六进制代码。例如:

0xFFFFFF 将会: color(255,255,255);

KA 中的颜色命令:

background(r, g, b)
Set the background color

fill(r, g, b)
Set the fill color for shapes

noFill()
Turn off fill for shapes

stroke(r, g, b)
Set the outline color for shapes

strokeWeight(thickness)
Change the thickness of lines and outlines

noStroke()
Turn off outlines for shapes

color(r, g, b)
Store a color in a variable

blendColor(c1, c2, MODE)
Blend two colors together

lerpColor(c1, c2, amount)
Find color between 2 colors```
于 2019-05-11T03:41:45.980 回答