OLD | NEW |
1 #!mojo mojo:sky_viewer | 1 #!mojo mojo:sky_viewer |
2 <sky> | 2 <sky> |
3 <import src="/sky/framework/debug/shake-to-reload.sky" /> | 3 <import src="/sky/framework/debug/shake-to-reload.sky" /> |
4 <style> | 4 <style> |
5 dot { | 5 dot { |
6 position: absolute; | 6 position: absolute; |
7 height: 10px; | 7 height: 10px; |
8 width: 10px; | 8 width: 10px; |
9 background-color: #00FF00; | 9 background-color: #00FF00; |
10 border-radius: 5px; | 10 border-radius: 5px; |
(...skipping 29 matching lines...) Expand all Loading... |
40 void goAway(event) { | 40 void goAway(event) { |
41 whichDot(event).remove(); | 41 whichDot(event).remove(); |
42 } | 42 } |
43 | 43 |
44 void stopDots(event) { | 44 void stopDots(event) { |
45 for (Element e in document.querySelectorAll('dot')) | 45 for (Element e in document.querySelectorAll('dot')) |
46 e.remove(); | 46 e.remove(); |
47 } | 47 } |
48 | 48 |
49 void runToTheCenter(event) { | 49 void runToTheCenter(event) { |
50 float radius = (5 + (95 * event.pressure)); | 50 double radius = (5 + (95 * event.pressure)); |
51 Element dot = whichDot(event); | 51 Element dot = whichDot(event); |
52 dot.style["transform"] = "translate(${event.x-radius}px,${event.y-radius}px)"; | 52 dot.style["transform"] = "translate(${event.x-radius}px,${event.y-radius}px)"; |
53 dot.style["width"] = "${2 * radius}px"; | 53 dot.style["width"] = "${2 * radius}px"; |
54 dot.style["height"] = "${2 * radius}px"; | 54 dot.style["height"] = "${2 * radius}px"; |
55 dot.style["border-radius"] = "${radius}px"; | 55 dot.style["border-radius"] = "${radius}px"; |
56 } | 56 } |
57 | 57 |
58 void main() { | 58 void main() { |
59 document.addEventListener("pointerdown", moreDots); | 59 document.addEventListener("pointerdown", moreDots); |
60 document.addEventListener("pointermove", runToTheCenter); | 60 document.addEventListener("pointermove", runToTheCenter); |
61 document.addEventListener("pointerup", goAway); | 61 document.addEventListener("pointerup", goAway); |
62 document.addEventListener("pointercancel", stopDots); | 62 document.addEventListener("pointercancel", stopDots); |
63 } | 63 } |
64 </script> | 64 </script> |
65 </sky> | 65 </sky> |
OLD | NEW |