xingzuo.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>星座配对</title>
  6. <meta name="description" content="">
  7. <meta http-equiv="X-UA-Compatible" content="chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="format-detection" content="telephone=no">
  12. <style>
  13. *{margin: 0; padding: 0;}
  14. .anim-box{ position: relative; width: 80%; height: 500px; margin: 50px auto; background-color: #000; color: #000;}
  15. .anim-box>*{position: absolute;}
  16. .anim-box span{width: 80px; height: 80px; line-height: 80px; text-align: center; border-radius: 100%; background-color: #fff; color: #000; z-index: 999;}
  17. .anim-box span{-webkit-transition: .8s; transition: .8s;}
  18. .anim-box ul{ bottom: 50px; left: 20px; font-size: 0;}
  19. .anim-box ul li{display: inline-block; width: 80px; height: 80px; line-height: 80px; margin: 20px 20px 0 0; text-align: center; border-radius: 100%; background-color: #c00; color: #fff; font-size: 14px;}
  20. @-webkit-keyframes beam{
  21. 0%{
  22. box-shadow:0 0 0px rgba(255,255,255,0);
  23. opacity: 0.3;
  24. }
  25. 50%{
  26. box-shadow: 0 0 100px rgba(255,255,255, 1);
  27. opacity: 1;
  28. }
  29. 100%{
  30. box-shadow:0 0 0px rgba(255,255,255,0);
  31. opacity: 0.3;
  32. background-color: #fff;
  33. }
  34. }
  35. @keyframes beam{
  36. 0%{
  37. box-shadow:0 0 0px rgba(255,255,255, 0);
  38. opacity: 0.3;
  39. }
  40. 50%{
  41. box-shadow:0 0 100px rgba(255,255,255, 1);
  42. opacity: 1;
  43. }
  44. 100%{
  45. box-shadow:0 0 0px 0px rgba(255,255,255, 0);
  46. opacity: 0.3;
  47. background-color: #fff;
  48. }
  49. }
  50. .beam{animation: beam 1s infinite ; -webkit-animation: beam 1s infinite ; }
  51. </style>
  52. </head>
  53. <body>
  54. <section class="anim-box">
  55. <span id="me">你</span>
  56. <ul class="xingzuo">
  57. <li>天秤座</li>
  58. <li>处女座</li>
  59. <li>水瓶座</li>
  60. <li>双子座</li>
  61. <li>双鱼座</li>
  62. <li>白羊座</li>
  63. </ul>
  64. </section>
  65. <script>
  66. ;!function(){
  67. var find = function(index){
  68. var me = document.getElementById('me');
  69. var ul = document.querySelectorAll('.xingzuo')[0];
  70. var xzs = ul.querySelectorAll('li');
  71. var x = xzs[index].offsetLeft + ul.offsetLeft;
  72. var y = xzs[index].offsetTop + ul.offsetTop;
  73. me.style['-webkit-transform'] = 'translate3d('+ x +'px, '+ y +'px, 0px) scale(0.5)';
  74. me.style['transform'] = 'translate3d('+ x +'px, '+ y +'px, 0px) scale(0.5)';
  75. me.style.opacity = 0.5;
  76. setTimeout(function(){
  77. xzs[index].className = 'beam';
  78. setTimeout(function(){
  79. me.removeAttribute('style');
  80. }, 500);
  81. }, 800);
  82. };
  83. setTimeout(function(){
  84. find(Math.random()*5|0) //模拟匹配
  85. }, 1000);
  86. }();
  87. </script>
  88. </body>
  89. </html>