Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. 知识库
  3. 二维积木
  4. 调色板控件

调色板控件

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 846 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creaticodeteacher2-mail
    wrote on last edited by admin
    #1

     

    先修科目

    • 标签控件

     

    介绍

    利用调色板可以让用户选择一种颜色(包括透明度),之后就可以在其它积木中使用这种颜色。

     

    添加调色板

     

    参数

    • 中心位置:调色板中心的x坐标、y坐标。
    • 调色板名称:名称必须唯一,之后用名称引用该调色板。

     

    调色板的使用

    点击圆形按钮即可打开调色板、关闭调色板。点击调色板窗口之外任意地方也可以关闭调色板。

    直接点击调色板即可选择颜色,然后在右下角检查预览窗口。

    你还可以利用底部的文本框查看色值、设置色值。左侧显示的总是16进制色值(下面将详细介绍这一格式),右侧栏目是RGBA或HSL格式。

     

    读取调色板

    你可以用这个积木读取调色板的色值:

     

    参数

    • 控件名称:你要选择读取哪个控件的值。对于调色板而言,其值就是用户选定的颜色。

     

    色值格式

    色值的格式是8位的16进制数“#RRGGBBAA”,例如"#3366ccff"。前2个16进制数"RR"代表红色成分,介于0至255之间。同理,"GG"代表绿色成分,"BB"代表蓝色成分,"AA"代表Alpha通道(即透明度,ff表示完全不透明,00表示完全透明)。

     

    响应调色板的变化事件

    你可以用这个积木监听调色板的变化事件:

     

    参数

    • 控件名称:你要选择监听哪个调色板的色值变化事件。

     

    范例

    下方录屏展示的是,每当用户从调色板选取新的颜色,如何更改标签的颜色。

    在这个程序中,每当调色板被更改,我们就读取其色值,然后把标签的背景色设置为这个色值。

     

    亲自尝试:

    https://play.creaticode.com/projects/d3bd41b637507db7257d4513

    1 Reply Last reply
    0

    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
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode