mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Clamp transparency value (at least for set)
This commit is contained in:
parent
8a77329c79
commit
f61366643d
1 changed files with 4 additions and 4 deletions
|
@ -382,8 +382,8 @@ class Scratch3PenBlocks {
|
||||||
*/
|
*/
|
||||||
changePenTransparencyBy (args, util) {
|
changePenTransparencyBy (args, util) {
|
||||||
const penState = this._getPenState(util.target);
|
const penState = this._getPenState(util.target);
|
||||||
|
const TRANSPARENCY = args.TRANSPARENCY / 100;
|
||||||
penState.penAttributes.color4f[3] = penState.penAttributes.color4f[3] + (args.TRANSPARENCY / 100);
|
penState.penAttributes.color4f[3] = penState.penAttributes.color4f[3] + TRANSPARENCY;
|
||||||
this._updatePenColor(penState);
|
this._updatePenColor(penState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ class Scratch3PenBlocks {
|
||||||
*/
|
*/
|
||||||
setPenTransparencyTo (args, util) {
|
setPenTransparencyTo (args, util) {
|
||||||
const penState = this._getPenState(util.target);
|
const penState = this._getPenState(util.target);
|
||||||
|
const TRANSPARENCY = MathUtil.clamp(args.TRANSPARENCY, 0, 100) / 100;
|
||||||
penState.penAttributes.color4f[3] = args.TRANSPARENCY / 100;
|
penState.penAttributes.color4f[3] = TRANSPARENCY;
|
||||||
this._updatePenColor(penState);
|
this._updatePenColor(penState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue