Last active
August 29, 2015 13:55
-
-
Save bwhite/8741534 to your computer and use it in GitHub Desktop.
[wearscript] All gestures get logged to the console and the onGesture results are spoken aloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
function show(msg) { | |
WS.log(msg) | |
WS.cardModify(0, WS.cardFactory(msg, '')); | |
} | |
function onGesture(gesture) { | |
show('onGesture: ' + gesture); | |
WS.say(gesture.replace('_', ' ')); | |
} | |
function onFingerCountChanged(i, i2) { | |
show('onFingerCountChanged: ' + i + ' ' + i2); | |
} | |
function onScroll(v, v2, v3) { | |
show('onScroll: ' + v + ' ' + v2 + ' ' + v3); | |
} | |
function onTwoFingerScroll(v, v2, v3) { | |
show('onTwoFingerScroll: ' + v + ' ' + v2 + ' ' + v3); | |
} | |
function onVerticalScroll(v, v2, v3) { | |
show('onVerticalScroll: ' + v + ' ' + v2 + ' ' + v3); | |
} | |
function server() { | |
WS.displayCardScroll(); | |
WS.cardInsert(0, WS.cardFactory('Touch Glass', '')); | |
var events = 'onGesture onFingerCountChanged onScroll onTwoFingerScroll onVerticalScroll'.split(' '); | |
for (var i = 0; i < events.length; i++) | |
WS.gestureCallback(events[i], events[i]); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
WS.serverConnect('{{WSUrl}}', 'server'); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "GDK Gestures Example" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment