<!DOCTYPE html>
Blockly Demo: Generating JavaScript $(function() { $('#draggable').draggable(); }); #draggable { padding:0.5em; } body{ background-color:#fff; font-family:sans-serif; }
Run JavaScript
10
customblcoks1.js
Blockly.Blocks['motion'] = {
init: function() {
this.appendDummyInput()
.appendField("move")
.appendField(new Blockly.FieldTextInput("20"), "NAME")
.appendField("steps");
this.setInputsInline(false);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(230);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.JavaScript['motion'] = function(block) {
var text_name = block.getFieldValue('NAME');
var code = '...;\n';
return code;
};