Discuss Scratch

101Corp
Scratcher
1000+ posts

RGB color on sprites using color effect block

Hello! I am coding something that requires RGB color (as in 0-255 in red, green, blue). I know I could do it with the pen tool but I'm wondering if I can do it with a sprite instead. How would I do this? Is it even possible in the first place? Thanks!

Last edited by 101Corp (Nov. 20, 2024 19:26:47)

1019734
Scratcher
6 posts

RGB color on sprites using color effect block

If you make the sprite white and use the color graphic effect, it should work
1019734
Scratcher
6 posts

RGB color on sprites using color effect block

set [color] effect to (100)
Elaver_3000
Scratcher
85 posts

RGB color on sprites using color effect block

1019734 wrote:

If you make the sprite white and use the color graphic effect, it should work
If you use white, it won't work. Use something that is red instead.
101Corp
Scratcher
1000+ posts

RGB color on sprites using color effect block

Thanks, but I meant converting a RGB color value to whatever Scratch uses, not a rainbow color effect.

Last edited by 101Corp (Nov. 20, 2024 19:27:04)

nembence
Scratcher
500+ posts

RGB color on sprites using color effect block

It's possible.
When color effect is applied to a red thing, then the rainbow effect is made like this:
The graphs consist of 6 equally long linear pieces, _=0, ‾=255
‾\__/‾ <- R
/‾‾\__ <- G
__/‾‾\ <- B
0-^ ^-200 <- color effect
After the color effect Scratch applies the brightness effect, that adds the same number to every RGB component.
R'= R + E,  G'= G + E,  B'= B + E
where E is 255*(brightness effect)/100
The last thing applied is the ghost effect, that makes the sprite transparent:
Result = Background*G + Sprite*(1-G)
where G is (ghost effect) / 100
Result, Background and Sprite are matching
RGB components of the result, background and sprite
1019734
Scratcher
6 posts

RGB color on sprites using color effect block

Make a sprite at color 0, brightness and saturation 100. Then find whatever color you want it to change to on it’s color slider, take that value, multiply it by 2, and it will become that color

Powered by DjangoBB