-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblocks.js
More file actions
264 lines (249 loc) · 8.74 KB
/
blocks.js
File metadata and controls
264 lines (249 loc) · 8.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#vyf2pz
Blockly.Blocks['waspot_ctrl_video'] = {
init: function() {
this.appendValueInput("videoId")
.setCheck(null)
.appendField("建立影片")
.appendField(new Blockly.FieldVariable("video"), "video")
.appendField(" , 使用 VideoTag ID:");
this.appendDummyInput()
.appendField("影片URL : ")
.appendField(new Blockly.FieldTextInput("http://webduino.tw/walkman.mp4"), "videoURL");
this.appendDummyInput()
.appendField("寬度")
.appendField(new Blockly.FieldTextInput("320"), "width");
this.appendDummyInput()
.appendField("高度")
.appendField(new Blockly.FieldTextInput("240"), "height");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(290);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#ht2mj4
Blockly.Blocks['waspot_setting_video'] = {
init: function() {
this.appendDummyInput()
.appendField("設定")
.appendField(new Blockly.FieldVariable("video"), "video")
.appendField("顯示座標 x:")
.appendField(new Blockly.FieldTextInput("320"), "x")
.appendField(" , y:")
.appendField(new Blockly.FieldTextInput("320"), "y")
.appendField(" , z-index")
.appendField(new Blockly.FieldTextInput("1"), "zIndex")
.appendField(" , 影片寬度")
.appendField(new Blockly.FieldTextInput("240"), "width");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(135);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
Blockly.Blocks['waspot_ctrl_video_action'] = {
init: function() {
this.appendDummyInput()
.appendField("使用")
.appendField(new Blockly.FieldVariable("video"), "video")
.appendField("進行")
.appendField(new Blockly.FieldDropdown([["播放", "play()"], ["暫停", "pause()"], ["停止", "load()"], ["顯示", "hidden=false"], ["隱藏", "hidden=true"]]), "action");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(130);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#ue69jh
Blockly.Blocks['waspot_show_actor'] = {
init: function () {
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown([["隱藏", "hide"], ["顯示", "show"]]), "visible")
.appendField(new Blockly.FieldVariable("actor"), "actor")
.appendField("的位置");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#8ttkr7
Blockly.Blocks['waspot_set_snd_url_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("設定")
.appendField(new Blockly.FieldVariable("actor"), "actor")
.appendField(" 聲音 URL:");
this.appendValueInput("sndURL")
.setCheck(null);
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#4i2maq
Blockly.Blocks['waspot_play_audio_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("播放")
.appendField(new Blockly.FieldVariable("actor"), "actor")
.appendField("聲音");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#eb4ter
Blockly.Blocks['waspot_touch_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("當")
.appendField(new Blockly.FieldVariable("actor"), "actor")
.appendField("被碰到時");
this.appendStatementInput("inside")
.setCheck(null)
.appendField("執行");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(30);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
Blockly.Blocks['waspot_reloadimg_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("設定")
.appendField(new Blockly.FieldVariable("actor"), "actor");
this.appendValueInput("imgURL")
.setCheck(null)
.appendField("圖片URL:");
this.appendValueInput("after")
.setCheck(null)
.appendField(" , ");
this.appendDummyInput()
.appendField("秒後回復原圖片");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
Blockly.Blocks['waspot_loadimg_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("設定")
.appendField(new Blockly.FieldVariable("actor"), "actor");
this.appendValueInput("imgURL")
.setCheck(null)
.appendField("圖片URL:");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#z4scj4
Blockly.Blocks['waspot_move_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("移動")
.appendField(new Blockly.FieldVariable("actor"), "actor");
this.appendValueInput("x")
.setCheck(null)
.appendField("到座標 x:");
this.appendValueInput("y")
.setCheck(null)
.appendField(" y:");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
Blockly.Blocks['waspot_set_image_size'] = {
init: function () {
this.appendDummyInput()
.appendField("設定")
.appendField(new Blockly.FieldVariable("actor"), "actor");
this.appendValueInput("width").setCheck(null)
.appendField("圖片 寬:");
this.appendValueInput("height")
.setCheck(null)
.appendField(", 高:");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(120);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
//https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#4n6dhn
Blockly.Blocks['waspot_create_actor'] = {
init: function () {
this.appendDummyInput()
.appendField("建立")
.appendField(new Blockly.FieldVariable("actor"), "actor")
.appendField(" 圖片URL:");
this.appendValueInput("imgURL")
.setCheck(null);
this.appendDummyInput()
.appendField(" 寬");
this.appendValueInput("width")
.setCheck(null);
this.appendDummyInput()
.appendField("高");
this.appendValueInput("height")
.setCheck(null);
this.appendDummyInput()
.appendField(",")
.appendField("放入")
.appendField(new Blockly.FieldVariable("camera"), "camera");
this.appendDummyInput();
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(330);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};
Blockly.Blocks['waspot_get_camera'] = {
init: function () {
this.appendDummyInput()
.appendField("建立")
.appendField(new Blockly.FieldVariable("camera"), "camera")
.appendField("並啟動,影像來源:")
.appendField(new Blockly.FieldTextInput("0"), "src")
.appendField(" 影像大小:")
.appendField(new Blockly.FieldDropdown([["320x240", "320,240"], ["480x360", "480,360"], ["640x480", "640,480"], ["800x600", "800,600"]]), "screenSize")
.appendField(" 旋轉鏡頭:")
.appendField(new Blockly.FieldCheckbox("FALSE"), "rotate")
.appendField(" 水平翻轉:")
.appendField(new Blockly.FieldCheckbox("TRUE"), "flip");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(330);
this.setTooltip('');
this.setHelpUrl('https://webduino.io/');
}
};