mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-28 17:02:23 -05:00
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
function Scratch3LooksBlocks(runtime) {
|
|
/**
|
|
* The runtime instantiating this block package.
|
|
* @type {Runtime}
|
|
*/
|
|
this.runtime = runtime;
|
|
}
|
|
|
|
/**
|
|
* Retrieve the block primitives implemented by this package.
|
|
* @return {Object.<string, Function>} Mapping of opcode to Function.
|
|
*/
|
|
Scratch3LooksBlocks.prototype.getPrimitives = function() {
|
|
return {
|
|
'looks_effectmenu': this.effectMenu,
|
|
'looks_changeeffectby': this.changeEffect,
|
|
'looks_seteffectto': this.setEffect,
|
|
'looks_cleargraphiceffects': this.clearEffects,
|
|
'looks_changesizeby': this.changeSize,
|
|
'looks_setsizeto': this.setSize,
|
|
'looks_size': this.getSize
|
|
};
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.effectMenu = function (args) {
|
|
return args.EFFECT.toLowerCase();
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.changeEffect = function (args, util) {
|
|
var newValue = args.CHANGE + util.target.effects[args.EFFECT];
|
|
util.target.setEffect(args.EFFECT, newValue);
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.setEffect = function (args, util) {
|
|
util.target.setEffect(args.EFFECT, args.VALUE);
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.clearEffects = function (args, util) {
|
|
util.target.clearEffects();
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.changeSize = function (args, util) {
|
|
util.target.setSize(util.target.size + args.CHANGE);
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.setSize = function (args, util) {
|
|
util.target.setSize(args.SIZE);
|
|
};
|
|
|
|
Scratch3LooksBlocks.prototype.getSize = function (args, util) {
|
|
return util.target.size;
|
|
};
|
|
|
|
module.exports = Scratch3LooksBlocks;
|