-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefinitions.ts
64 lines (59 loc) · 2.18 KB
/
definitions.ts
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
const musicColor = "#1DB954";
Blockly.Blocks['import_music'] = {
init: function() {
this.appendDummyInput()
.appendField("from music import Music");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(musicColor);
}
};
Blockly.Blocks['music_init'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("music"), "music")
.appendField(" = Music()");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(musicColor);
}
};
Blockly.Blocks['music_get_song'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("song"), "song")
.appendField(" = ")
.appendField(new Blockly.FieldVariable("music"), "music")
.appendField(".get_song(");
this.appendValueInput("parameters")
.setCheck(null);
this.appendDummyInput()
.appendField(")");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(musicColor);
}
};
Blockly.Blocks['music_play_song'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("song"), "song")
.appendField(".play()");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(musicColor);
}
};
Blockly.Blocks['music_get_feature'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("song"), "song")
.appendField(".")
.appendField(new Blockly.FieldDropdown([["name","name"], ["artists","artists"], ["danceability","danceability"], ["energy","energy"], ["key","key"], ["loudness","loudness"], ["speechiness","speechiness"], ["acousticness","acousticness"], ["instrumentalness","instrumentalness"], ["liveness","liveness"], ["valence","valence"], ["tempo","tempo"]]), "feature");
this.setInputsInline(true);
this.setOutput(true, null);
this.setColour(musicColor);
}
};