ScratchAddons icon indicating copy to clipboard operation
ScratchAddons copied to clipboard

Alpha (Opacity) slider in costume editor.

Open Tacodiva opened this issue 3 years ago • 6 comments

Currently, there are only color, brightness and saturation sliders in the color picker. I suggest adding a new one for alpha (or opacity). In vanilla scratch the only way to get semi-opaque pixels is using bucket fill option and selecting a gradient between no color and a fully opaque color. This creates major headaches if you want a large section of the same opacity as you have to copy the pixel that has the opacity you want to create a large section of those pixels.

An example of opacity in the costum editor created with the bucket fill gradient method. image

Tacodiva avatar Apr 11 '21 05:04 Tacodiva

Hmm, I've tried this before

The existing colour picker addons simulate a colour picker selecting a specific colour, but this only works for opaque values

I think I tried messing with redux a bit, but it seems scratch-paint explicitly checks for valid 6-digit hex colours (i.e. no transparency)

However, I know that with imported SVG costumes, the colour picker does support transparency when you select a shape with a translucent stroke/fill, so maybe not all hope is lost?

SheepTester avatar Apr 11 '21 05:04 SheepTester

@SheepTester Not all hope is lost, because scratch does support transparent SVGs. In fact, I was able to create my own, from selecting a shape in a costume, and changing its properties through Redux. And in the "scratch-paint/select/CHANGE_SELECTED_ITEMS" event, you will get a selectedItems array. And... As you can see, it has tons of things that we can edit... image I once remembered seeing a transparency value, so let's see where that is... image And look what we have here... image image So it's actually quite simple, but the hard part, is getting the UI right... Before when I was trying to make this addon... I had all the code down, but the UI was just an input that get's appended to the screen where the rest of the tools are. So maybe there is a better way? But an input would also work...

TheColaber avatar Apr 11 '21 11:04 TheColaber

So it's not possible to set your pen color in bitmap mode to something transparent? I don't know much about redux but is it not possible to change the state required without going through the scratch reducer? It's a shame, I mainly wanted this for use with bitmap.

Tacodiva avatar Apr 13 '21 05:04 Tacodiva

So it's not possible to set your pen color in bitmap mode to something transparent? I don't know much about redux but is it not possible to change the state required without going through the scratch reducer? It's a shame, I mainly wanted this for use with bitmap.

I wish it was that easy, but scratch checks the values set before drawing and removes an opacity it sees.

TheColaber avatar Apr 13 '21 12:04 TheColaber

Bitmap does have rudimentary support for transparency it seems; just not for strokes

I think this is fine since the fill tool works, but users might continually report the behaviour of the pen etc. as a bug

SheepTester avatar Apr 13 '21 16:04 SheepTester

For the record: This suggestion is highly anticipated. Hundreds of (duplicate) website feedback, Discord suggestions, Scratch comments have already been made. This suggestion is amplified that it is already implemented in TurboWarp.

Hans5958 avatar Sep 22 '22 11:09 Hans5958