Set Pen () to () | |
set pen (color v) to () | |
Category | Pen Extension |
Type | Stack |
Introduced in | 3.0 |
Set Pen () to () block is a pen extension block and a Stack block that is in Scratch 3.0. This block sets the pen's color, saturation, brightness (also known as shade), and transparency. The first value can be selected from "color" (default), "saturation", "brightness", and "transparency."
How to Use
This block will set the hue (color), saturation, brightness, or alpha (transparency). This way of representing color is called HSBA. It is one of the easiest-to-understand ways that computers can represent color. The Scratch color picker uses HSBA so it makes sense to use it in pen projects.
Examples
- Set the pen color with numeric HSBA
define Set pen color to H(H) S(S) B(B) A(A) set pen (color v) to (H) set pen (saturation v) to (S) set pen (brightness v) to (B) set pen (transparency v) to (A)
- Use a color the user inputs.
when flag clicked ask [What color do you want to use?] and wait set pen (color v) to (answer) pen down repeat (10) move (10) steps turn cw (36) degrees end
- Set a random color
set pen (color v) to (pick random (1) to (100)) set pen (saturation v) to (pick random (1) to (100)) set pen (brightness v) to (pick random (1) to (100)) set pen (transparency v) to (pick random (1) to (100))