Team:Shenzhen BGIC ATCG/front.html
From 2013.igem.org
(Difference between revisions)
Line 16: | Line 16: | ||
<link rel="stylesheet" type="text/css" href="https://2013.igem.org/Team:Shenzhen_BGIC_ATCG/css/front.css?action=raw&ctype=text/css" media="screen" /> | <link rel="stylesheet" type="text/css" href="https://2013.igem.org/Team:Shenzhen_BGIC_ATCG/css/front.css?action=raw&ctype=text/css" media="screen" /> | ||
<link rel="stylesheet" type="text/css" href="https://2013.igem.org/Team:Shenzhen_BGIC_ATCG/css/display.css?action=raw&ctype=text/css" /> | <link rel="stylesheet" type="text/css" href="https://2013.igem.org/Team:Shenzhen_BGIC_ATCG/css/display.css?action=raw&ctype=text/css" /> | ||
+ | <script type="text/javascript">var getAngle = function(Xc, Yc, Xa, Ya, Xb, Yb) { | ||
+ | var v1x = Xb - Xc; | ||
+ | var v1y = Yb - Yc; | ||
+ | var v2x = Xa - Xc; | ||
+ | var v2y = Ya - Yc; | ||
+ | return 180 * (Math.atan2(v1x, v1y) - Math.atan2(v2x, v2y)) / Math.PI | ||
+ | }; | ||
+ | var left_center_offset = { | ||
+ | left: 30, | ||
+ | top: 82 | ||
+ | }, | ||
+ | right_center_offset = { | ||
+ | left: 96, | ||
+ | top: 80 | ||
+ | }, | ||
+ | radius = 10; | ||
+ | var setEyeOffset = function(event) { | ||
+ | var offset = $(".eye_wrapper").offset(); | ||
+ | var x1 = offset.left + left_center_offset.left; | ||
+ | var y1 = offset.top + left_center_offset.top; | ||
+ | var x2 = offset.left + right_center_offset.left; | ||
+ | var y2 = offset.top + right_center_offset.top; | ||
+ | var n1 = event.clientX - x1; | ||
+ | var m1 = -(event.clientY - y1); | ||
+ | var k1 = Math.atan2(m1, n1); | ||
+ | var n2 = event.clientX - x2; | ||
+ | var m2 = -(event.clientY - y2); | ||
+ | var k2 = Math.atan2(m2, n2); | ||
+ | var x11 = (Math.cos(k1) * radius + x1).toFixed(0); | ||
+ | var y11 = (( - Math.sin(k1) * radius) + y1).toFixed(0); | ||
+ | $(".eye-left").offset({ | ||
+ | left: x11, | ||
+ | top: y11 | ||
+ | }); | ||
+ | var x22 = (Math.cos(k2) * radius + x2).toFixed(0); | ||
+ | var y22 = (( - Math.sin(k2) * radius) + y2).toFixed(0); | ||
+ | $(".eye-right").offset({ | ||
+ | left: x22, | ||
+ | top: y22 | ||
+ | }) | ||
+ | }; | ||
+ | </script> | ||
<body> | <body> | ||
Line 61: | Line 103: | ||
<img alt="Ball" class="eye-right" id="eye_right" src="https://static.igem.org/mediawiki/2013/4/4c/Eyewhite.png" style="top: 89px; left: 100.5px;"> | <img alt="Ball" class="eye-right" id="eye_right" src="https://static.igem.org/mediawiki/2013/4/4c/Eyewhite.png" style="top: 89px; left: 100.5px;"> | ||
</div> | </div> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
<script type="text/javascript" src="https://2012.igem.org/Team:Shenzhen/js/jquery.min.js"></script> | <script type="text/javascript" src="https://2012.igem.org/Team:Shenzhen/js/jquery.min.js"></script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 10:19, 13 September 2013