43 lines
1.5 KiB
JSON
43 lines
1.5 KiB
JSON
{
|
|
"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"
|
|
}
|
|
]
|
|
} |