OLD | NEW |
---|---|
1 <sky> | 1 <sky> |
2 <div id="log">Ready</div> | 2 <import src="fps-counter.sky" /> |
3 <style> | |
4 dot { | |
5 position: absolute; | |
6 height: 100px; | |
7 width: 100px; | |
8 background-color: #00FF00; | |
9 } | |
10 </style> | |
11 <dot /> | |
12 <log>Ready</log> | |
13 <x-fps-counter /> | |
ojan
2015/01/15 18:54:57
Does this work? Shouldn't this just be fps-counter
abarth-chromium
2015/01/15 19:09:38
Oops. We did this to comment it out. I'll add it
| |
3 <script> | 14 <script> |
15 var dot = document.querySelector("dot"); | |
16 var log = document.querySelector("log"); | |
17 | |
4 function logTouchEvent(evt) { | 18 function logTouchEvent(evt) { |
5 var message = "type=" + event.type; | 19 var message = "type=" + event.type; |
6 if (evt.touches && evt.touches.length > 0) | 20 if (evt.touches && evt.touches.length > 0) { |
7 message += " x=" + evt.touches[0].clientX + " y=" + evt.touches[0].clientY; | 21 var x = evt.touches[0].clientX.toFixed(2); |
8 document.getElementById("log").textContent = message; | 22 var y = evt.touches[0].clientY.toFixed(2); |
23 message += " x=" + x + " y=" + y; | |
24 | |
25 var transform = "translate(" + (x - 50) + "px," + (y - 50) + "px)"; | |
26 dot.style.transform = transform; | |
27 } | |
28 log.textContent = message; | |
9 } | 29 } |
10 | 30 |
11 document.documentElement.addEventListener("touchstart", logTouchEvent); | 31 document.documentElement.addEventListener("touchstart", logTouchEvent); |
12 document.documentElement.addEventListener("touchmove", logTouchEvent); | 32 document.documentElement.addEventListener("touchmove", logTouchEvent); |
13 document.documentElement.addEventListener("touchend", logTouchEvent); | 33 document.documentElement.addEventListener("touchend", logTouchEvent); |
14 document.documentElement.addEventListener("touchcancel", logTouchEvent); | 34 document.documentElement.addEventListener("touchcancel", logTouchEvent); |
15 </script> | 35 </script> |
16 </sky> | 36 </sky> |
37 s | |
esprehn
2015/01/14 23:48:54
typo
| |
OLD | NEW |