Copiando o repositório do Alexandre
This commit is contained in:
1 parent
a3e604697b
commit
0ab8836265
363 files changed
+27249
No files matched your search
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.date",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Date",
|
||||
"label": "Date",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = $label$\nvar $port[day]$ = [];\nvar $port[month]$ = [];\nvar $port[year]$ = [];\n\nvar $port[generate]$ = function(value){\n var d = new Date();\n for (var i = 0; i < $port[day]$.length ; i++){\n $port[day]$[i](d.getDate());\n }\n for (var i = 0; i < $port[month]$.length ; i++){\n $port[month]$[i](d.getMonth());\n }\n for (var i = 0; i < $port[year]$.length ; i++){\n $port[year]$[i](d.getFullYear());\n }\n return true;\n };\n\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "day",
|
||||
"label": "Day",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "month",
|
||||
"label": "Month",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "year",
|
||||
"label": "Year",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "input",
|
||||
"name": "generate",
|
||||
"label": "Generate",
|
||||
"type": "javascript.float"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.deviceorientation",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Device Orientation",
|
||||
"label": "Device Orientation",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "onload",
|
||||
"code": "\nwindow.addEventListener('deviceorientation', handleDeviceOrientation$id$);\n "
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\nvar $port[alpha]$ = [];\nvar $port[beta]$ = [];\nvar $port[gamma]$ = [];\n\nfunction handleDeviceOrientation$id$(event){\n for (var i = 0 ; i < $port[alpha]$.length ; i++)\n $port[alpha]$[i](event.alpha);\n \n for (var i = 0 ; i < $port[beta]$.length ; i++)\n $port[beta]$[i](event.beta);\n \n for (var i = 0 ; i < $port[gamma]$.length ; i++)\n $port[gamma]$[i](event.gamma); \n} \n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "alpha",
|
||||
"label": "Alpha",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "beta",
|
||||
"label": "Beta",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "gamma",
|
||||
"label": "Gamma",
|
||||
"type": "javascript.float"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.hour",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Hour",
|
||||
"label": "Hour",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = $label$\nvar $port[hour]$ = [];\nvar $port[minute]$ = [];\nvar $port[second]$ = [];\nvar $port[millisecond]$ = [];\nvar $port[time]$ = [];\n\nvar $port[generate]$ = function(value){\n var d = new Date();\n for (var i = 0; i < $port[hour]$.length ; i++){\n $port[hour]$[i](d.getHours());\n }\n for (var i = 0; i < $port[minute]$.length ; i++){\n $port[minute]$[i](d.getMinutes());\n }\n for (var i = 0; i < $port[second]$.length ; i++){\n $port[second]$[i](d.getSeconds());\n }\n for (var i = 0; i < $port[millisecond]$.length ; i++){\n $port[millisecond]$[i](d.getMilliseconds());\n }\n for (var i = 0; i < $port[time]$.length ; i++){\n $port[time]$[i](d.getTime());\n }\n return true;\n };\n\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "hour",
|
||||
"label": "Hour",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "minute",
|
||||
"label": "Minute",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "second",
|
||||
"label": "Second",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "millisecond",
|
||||
"label": "Millisecond",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "time",
|
||||
"label": "Time",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "input",
|
||||
"name": "generate",
|
||||
"label": "Generate",
|
||||
"type": "javascript.float"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.keyboard",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Keyboard",
|
||||
"label": "Keyboard",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "function",
|
||||
"code": "\nvar keyboard_char_output = [];\nvar keyboard_float_output = [];\ndocument.onkeypress = function(evt){\n evt = evt || window.event;\n\n var value = evt.keyCode || evt.which;\n for (var i = 0; i < keyboard_float_output.length ; i++)\n for (var j = 0; j < keyboard_float_output[i].length ; j++)\n keyboard_float_output[i][j](value);\n\n value = String.fromCharCode(value);\n for (var i = 0; i < keyboard_char_output.length ; i++)\n for (var j = 0; j < keyboard_char_output[i].length ; j++)\n keyboard_char_output[i][j](value);\n};\n"
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = KeyBoard Input\nvar $port[char_output]$ = [];\nvar $port[float_output]$ = [];\nkeyboard_char_output.push($port[char_output]$);\nkeyboard_float_output.push($port[float_output]$);\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "float_output",
|
||||
"label": "Float Output",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "char_output",
|
||||
"label": "Char Output",
|
||||
"type": "javascript.char"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.microphone",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Microphone",
|
||||
"label": "Microphone",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n</script>\n<div>\n <span class=\"title\">Microphone</span>\n</div>\n<div>\n <div>\n <span class=\"label\">Gain</span>\n <input type=\"range\" id=\"gain-slider_$id$\" class=\"slider\" min=\"-20\" max=\"20\" step=\"1\" value=\"0\" />\n <span id=\"gain-display_$id$\" class=\"label\">0 db</span>\n </div>\n</div>\n\n<script>\n var gain = 0;\n var audioSource;\n var block_$id$;\n\n block_$id$ = context.createBiquadFilter();\n block_$id$.type = \"lowshelf\";\n block_$id$.frequency.value = 1000;\n\n var $port[output]$ = block_$id$;\n\n navigator.getUserMedia =\n navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n navigator.msGetUserMedia;\n\nif (navigator.getUserMedia) {\n navigator.getUserMedia (\n {\n audio: true,\n video: false\n },\n function (stream) {\n audioSource = context.createMediaStreamSource(stream);\n\n var gainDisplay = document.getElementById('gain-display_$id$');\n var gainSlider = document.getElementById('gain-slider_$id$');\n\n gainSlider.addEventListener('input', function () {\n gain = parseFloat(gainSlider.value)\n gainDisplay.textContent = gain + ' db';\n block_$id$.gain.value = gainSlider.value;\n });\n\n audioSource.connect(block_$id$);\n },\n function (err) {\n console.log('Error initializing user media stream: ' + err);\n }\n );\n}\n"
|
||||
},
|
||||
{
|
||||
"name": "onload",
|
||||
"code": ""
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "output",
|
||||
"label": "Output",
|
||||
"type": "javascript.sound"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.mouseclick",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Mouse Click",
|
||||
"label": "Mouse Click",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "function",
|
||||
"code": "\n// ----------------- Mouse click ----------------------------\n// Variable to keep output ports\nvar x_click_ports = [];\nvar y_click_ports = [];\nvar button_click_ports = [];\n\ndocument.onmousedown = getMouseClick;\nfunction getMouseClick(event) {\n // X value\n for (var i = 0; i < x_click_ports.length ; i++)\n for (var j = 0; j < x_click_ports[i].length ; j++)\n x_click_ports[i][j](event.x);\n\n // Y value\n for (var i = 0; i < y_click_ports.length ; i++)\n for (var j = 0; j < y_click_ports[i].length ; j++)\n y_click_ports[i][j](event.y);\n\n // Button value\n for (var i = 0; i < button_click_ports.length ; i++)\n for (var j = 0; j < button_click_ports[i].length ; j++)\n button_click_ports[i][j](event.button);\n\n return true\n}\n// ----------------- Mouse position ----------------------------\n\n"
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = Mouse\nvar $port[x]$ = [];\nvar $port[y]$ = [];\nvar $port[button]$ = [];\nx_click_ports.push($port[x]$);\ny_click_ports.push($port[y]$);\nbutton_click_ports.push($port[button]$);\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "x",
|
||||
"label": "X",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "y",
|
||||
"label": "Y",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "button",
|
||||
"label": "Button",
|
||||
"type": "javascript.float"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.mouseposition",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Mouse Position",
|
||||
"label": "Mouse Position",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "function",
|
||||
"code": "\n// ----------------- Mouse position ----------------------------\n// Detect if the browser is IE or not.\n// If it is not IE, we assume that the browser is NS.\nvar IE = document.all?true:false\n\n// If NS -- that is, !IE -- then set up for mouse capture\nif (!IE) document.captureEvents(Event.MOUSEMOVE)\n\n// Set-up to use getMouseXY function onMouseMove\ndocument.onmousemove = getMouseXY;\n\n// Temporary variables to hold mouse x-y pos.s\nvar tempX = 0\nvar tempY = 0\n\n// Variable to keep output ports\nvar x_ports = [];\nvar y_ports = [];\n\n// Main function to retrieve mouse x-y pos.s\n\nfunction getMouseXY(e) {\n if (IE) { // grab the x-y pos.s if browser is IE\n tempX = event.clientX + document.body.scrollLeft\n tempY = event.clientY + document.body.scrollTop\n } else { // grab the x-y pos.s if browser is NS\n tempX = e.pageX\n tempY = e.pageY\n }\n // catch possible negative values in NS4\n if (tempX < 0){tempX = 0}\n if (tempY < 0){tempY = 0}\n\n // X value\n for (var i = 0; i < x_ports.length ; i++)\n for (var j = 0; j < x_ports[i].length ; j++)\n x_ports[i][j](tempX);\n\n // Y value\n for (var i = 0; i < y_ports.length ; i++)\n for (var j = 0; j < y_ports[i].length ; j++)\n y_ports[i][j](tempY);\n return true\n}\n// ----------------- Mouse position ----------------------------\n\n"
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = Mouse\nvar $port[x]$ = [];\nvar $port[y]$ = [];\nx_ports.push($port[x]$);\ny_ports.push($port[y]$);\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "x",
|
||||
"label": "X",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "y",
|
||||
"label": "Y",
|
||||
"type": "javascript.float"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.orientationchange",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "Orientation Change",
|
||||
"label": "Orientation Change",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "onload",
|
||||
"code": "\nwindow.addEventListener('orientationchange', onOrientationChange$id$, false);\n "
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\nvar $port[portrait]$ = [];\nvar $port[landscape]$ = [];\n\nfunction onOrientationChange$id$(event){\n var isPortrait = window.orientation % 180 === 0;\n if (window.orientation % 180 === 0) {\n for (var i = 0 ; i < $port[portrait]$.length ; i++)\n $port[portrait]$[i](isPortrait);\n \n } else { \n for (var i = 0 ; i < $port[landscape]$.length ; i++)\n $port[landscape]$[i](isPortrait);\n } \n}\n"
|
||||
},
|
||||
{
|
||||
"name": "execution",
|
||||
"code": "\nonOrientationChange$id$();\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "portrait",
|
||||
"label": "Portrait",
|
||||
"type": "javascript.bool"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "landscape",
|
||||
"label": "Landscape",
|
||||
"type": "javascript.bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"source": "JSON",
|
||||
"data": "BLOCK",
|
||||
"version": "0.0.1",
|
||||
"type": "javascript.input devices.upkeyboard",
|
||||
"language": "javascript",
|
||||
"extension": "webaudio",
|
||||
"help": "UpKeyboard",
|
||||
"label": "UpKeyboard",
|
||||
"color": "#4283FA",
|
||||
"group": "Input Device",
|
||||
"codes": [
|
||||
{
|
||||
"name": "function",
|
||||
"code": "\nvar keyboard_char_output = [];\nvar keyboard_float_output = [];\ndocument.onkeyup = function(evt){\n evt = evt || window.event;\n\n var value = evt.keyCode || evt.which;\n for (var i = 0; i < keyboard_float_output.length ; i++)\n for (var j = 0; j < keyboard_float_output[i].length ; j++)\n keyboard_float_output[i][j](value);\n\n value = String.fromCharCode(value);\n for (var i = 0; i < keyboard_char_output.length ; i++)\n for (var j = 0; j < keyboard_char_output[i].length ; j++)\n keyboard_char_output[i][j](value);\n};\n"
|
||||
},
|
||||
{
|
||||
"name": "declaration",
|
||||
"code": "\n// block_$id$ = KeyBoard Input\nvar $port[char_output]$ = [];\nvar $port[float_output]$ = [];\nkeyboard_char_output.push($port[char_output]$);\nkeyboard_float_output.push($port[float_output]$);\n"
|
||||
}
|
||||
],
|
||||
"properties": [],
|
||||
"ports": [
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "float_output",
|
||||
"label": "Float Output",
|
||||
"type": "javascript.float"
|
||||
},
|
||||
{
|
||||
"conn_type": "output",
|
||||
"name": "char_output",
|
||||
"label": "Char Output",
|
||||
"type": "javascript.char"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user