mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Add show/hide blocks using ghost effect as backend
This commit is contained in:
parent
6891a3a5dd
commit
ce941c6fd8
2 changed files with 22 additions and 0 deletions
|
@ -12,6 +12,8 @@ function Scratch3LooksBlocks(runtime) {
|
|||
*/
|
||||
Scratch3LooksBlocks.prototype.getPrimitives = function() {
|
||||
return {
|
||||
'looks_show': this.show,
|
||||
'looks_hide': this.hide,
|
||||
'looks_effectmenu': this.effectMenu,
|
||||
'looks_changeeffectby': this.changeEffect,
|
||||
'looks_seteffectto': this.setEffect,
|
||||
|
@ -22,6 +24,14 @@ Scratch3LooksBlocks.prototype.getPrimitives = function() {
|
|||
};
|
||||
};
|
||||
|
||||
Scratch3LooksBlocks.prototype.show = function (args, util) {
|
||||
util.target.setVisible(true);
|
||||
};
|
||||
|
||||
Scratch3LooksBlocks.prototype.hide = function (args, util) {
|
||||
util.target.setVisible(false);
|
||||
};
|
||||
|
||||
Scratch3LooksBlocks.prototype.effectMenu = function (args) {
|
||||
return args.EFFECT.toLowerCase();
|
||||
};
|
||||
|
|
|
@ -24,6 +24,8 @@ Clone.prototype.y = 0;
|
|||
|
||||
Clone.prototype.direction = 90;
|
||||
|
||||
Clone.prototype.visible = true;
|
||||
|
||||
Clone.prototype.size = 100;
|
||||
|
||||
Clone.prototype.effects = {
|
||||
|
@ -51,6 +53,16 @@ Clone.prototype.setDirection = function (direction) {
|
|||
});
|
||||
};
|
||||
|
||||
Clone.prototype.setVisible = function (visible) {
|
||||
this.visible = visible;
|
||||
// @todo: Until visibility is implemented in the renderer, use a ghost.
|
||||
if (this.visible) {
|
||||
this.setEffect('ghost', 0);
|
||||
} else {
|
||||
this.setEffect('ghost', 100);
|
||||
}
|
||||
};
|
||||
|
||||
Clone.prototype.setSize = function (size) {
|
||||
this.size = MathUtil.clamp(size, 5, 535);
|
||||
self.renderer.updateDrawableProperties(this.drawableID, {
|
||||
|
|
Loading…
Reference in a new issue