LoginSignup
0
0

More than 3 years have passed since last update.

blocklyでobjectを動かす。 その12

Posted at

0

概要

blocklyでobjectを動かして見る。
youtube、やってみた。

写真

image

ステージを作る。

<div id="outp"></div>

ブロックを書く。

Blockly.Blocks.tube = {
    init: function() {
        this.jsonInit({
            message0: "tube %1",
            args0: [{
                type: "input_value",
                name: "TEXT"
            }],
            previousStatement: null,
            nextStatement: null,
            style: "text_blocks",
            tooltip: Blockly.Msg.TEXT_PRINT_TOOLTIP,
            helpUrl: Blockly.Msg.TEXT_PRINT_HELPURL
        })
    }
};

フローを書く。

image

objectを書く。

Blockly.JavaScript.tube = function(a) {
    return "tube(" + (Blockly.JavaScript.valueToCode(a, "TEXT", Blockly.JavaScript.ORDER_NONE) || "''") + ");\n"
};
var out = document.getElementById("outp");

function tube(src) {
    out.innerHTML = '<iframe width="240" height="200" src="https://www.youtube.com/embed/' + src + '" frameborder="0"></iframe>';
}

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0