-
简介
当你点击颜色输入时,你可以使用颜色选择器工具获取你所点击的任意一点的准确的颜色数值。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/003c3010-4887-45ec-afd7-c81bbe33c640.gif" width="450" style="border-radius: 5px; border: 1px solid #29622d;">
实际上,你可以使用一个积木来实现这一点,这将让你的程序可以自动“扫描”舞台。
说明
要读取舞台上任意位置的颜色数值,你可以使用以下积木:

X位置和Y位置
前2个输入是你希望读取的一点的X位置和Y位置。例如,如果你希望知道舞台中间点的颜色,那么你应该在这两个输入中输入0。
输出变量
每一种颜色实际上是由4个数字来表示:颜色、亮度、饱和度和透明度。在使用这个积木之前,你必须首先定义4个变量,然后在积木的4个下拉菜单中选择这些变量。
运行该积木后,这4个变量将保存表示一种颜色的4个数字。
演示
如图所示,我们首先使用颜色选择器工具手动读取舞台中心的褐色,这将让我们得到以下数值:颜色 = 9,饱和度 = 81,亮度 = 60,透明度 = 0。
接下来,我们将使用“读入颜色”积木,这将把相同的4个数字保存在4个变量中:颜色 = 9,饱和度 = 81,亮度 = 60,透明度 = 0。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b498a975-da6f-4046-ab8d-f8e7bbe67659.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">
-
C CreatiCode Teacher moved this topic from Draft on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login