html and css3 js制作逗比效果前端只有你想不到没有它做不到的cid1101

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>PROFILE</title>
  7. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  8. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  9. <style>
  10. /*--------------------
  11. Body
  12. --------------------*/
  13. *,
  14. *::before,
  15. *::after {
  16. box-sizing: border-box;
  17. }
  18. html, body {
  19. height: 100%;
  20. background: #fb527a;
  21. }
  22. /*--------------------
  23. Mixins
  24. --------------------*/
  25. /*--------------------
  26. Wrapper
  27. --------------------*/
  28. .wrapper {
  29. position: absolute;
  30. top: 50%;
  31. left: 50%;
  32. -webkit-transform: translate(-50%, -50%);
  33. transform: translate(-50%, -50%);
  34. width: 369px;
  35. height: 547px;
  36. font-family: 'Source Sans Pro', sans-serif;
  37. -webkit-transform-style: preserve-3d;
  38. transform-style: preserve-3d;
  39. -webkit-transform: translate(-50%, -50%) perspective(600px) rotateY(20deg) rotateX(10deg);
  40. transform: translate(-50%, -50%) perspective(600px) rotateY(20deg) rotateX(10deg);
  41. }
  42. /*--------------------
  43. Me
  44. --------------------*/
  45. .me {
  46. position: relative;
  47. width: 369px;
  48. height: 547px;
  49. -webkit-transform: translateZ(80px) scale(0.8);
  50. transform: translateZ(80px) scale(0.8);
  51. }
  52. .me::before, .me::after {
  53. content: '';
  54. position: absolute;
  55. width: 100%;
  56. height: 100%;
  57. top: 0;
  58. left: 0;
  59. border-radius: 10px;
  60. background: url("images/profile.png") no-repeat 0 0;
  61. }
  62. .me::after {
  63. height: 30px;
  64. top: auto;
  65. bottom: -15px;
  66. z-index: -1;
  67. -webkit-filter: blur(15px);
  68. filter: blur(15px);
  69. background-size: 100% 30px;
  70. border-radius: 100px;
  71. }
  72. .me .eye, .me .eye::before {
  73. width: 70px;
  74. height: 70px;
  75. position: absolute;
  76. top: 175px;
  77. left: 120px;
  78. z-index: -1;
  79. background: url(http://www.supah.it/dribbble/006/eye.png) no-repeat center;
  80. }
  81. .me .eye::before {
  82. content: '';
  83. top: -2px;
  84. left: 97px;
  85. }
  86. .text {
  87. position: absolute;
  88. top: 0;
  89. left: 0;
  90. z-index: 2;
  91. width: 390px;
  92. height: 595px;
  93. -webkit-transform: translateZ(150px) translateX(-11px) translateY(-26px) scale(0.55);
  94. transform: translateZ(150px) translateX(-11px) translateY(-26px) scale(0.55);
  95. border: 3px solid white;
  96. text-align: center;
  97. font-size: 100px;
  98. line-height: 1000px;
  99. color: white;
  100. background: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.36) 39%, rgba(255, 255, 255, 0.07) 41%, rgba(255, 255, 255, 0) 51%, black 100%);
  101. opacity: .3;
  102. border-radius: 8px;
  103. }
  104. .text::after {
  105. content: 'webdesigner';
  106. width: 100%;
  107. position: absolute;
  108. bottom: 22px;
  109. left: 0;
  110. width: 100%;
  111. z-index: 1;
  112. line-height: 1;
  113. font-size: 18px;
  114. text-align: center;
  115. text-transform: uppercase;
  116. letter-spacing: 20px;
  117. text-indent: 20px;
  118. }
  119. .social-icons li {
  120. display: inline;
  121. padding-right: 10px;
  122. }
  123. .social-icons li a i {
  124. font-size:20px;
  125. color: #000;
  126. }
  127. ul.social-icons.list-inline {
  128. text-align: center;
  129. }
  130. </style>
  131. </head>
  132. <body>
  133. <div class="wrapper">
  134. <div class="card">
  135. <div class="me">
  136. <div class="eye"></div>
  137. </div>
  138. <div class="text">
  139. DEMON
  140. </div>
  141. </div>
  142. <ul class="social-icons list-inline">
  143. <li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
  144. <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
  145. <li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
  146. <li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
  147. <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
  148. </ul>
  149. </div>
  150. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  151. <script>
  152. var $wrap = $('.wrapper'),
  153. $lEye = $('.eye'),
  154. lFollowX = 5,
  155. lFollowY = 10,
  156. x = 0,
  157. y = 0,
  158. friction = 1 / 12;
  159. function animate() {
  160. x += (lFollowX - x) * friction;
  161. y += (lFollowY - y) * friction;
  162. $lEye.css({
  163. '-webit-transform': 'translate(' + -x + 'px, ' + -y + 'px)',
  164. '-moz-transform': 'translate(' + -x + 'px, ' + -y + 'px)',
  165. 'transform': 'translate(' + -x + 'px, ' + -y + 'px)'
  166. });
  167. $wrap.css({
  168. 'transform': 'translate(-50%, -50%) perspective(600px) rotateY(' + -x + 'deg) rotateX(' + y + 'deg)'
  169. });
  170. window.requestAnimationFrame(animate);
  171. }
  172. $(window).on('mousemove click', function(e) {
  173. var lMouseX = Math.max(-100, Math.min(100, $(window).width() / 2 - e.clientX));
  174. var lMouseY = Math.max(-100, Math.min(100, $(window).height() / 2 - e.clientY));
  175. lFollowX = (12 * lMouseX) / 100; // 100 : 12 = lMouxeX : lFollow
  176. lFollowY = (10 * lMouseY) / 100;
  177. });
  178. animate();
  179. </script>
  180. </body>
  181. </html>
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="UTF-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>PROFILE</title>
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
       
       <style>
       
       /*--------------------
Body
--------------------*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #fb527a;
}

/*--------------------
Mixins
--------------------*/
/*--------------------
Wrapper
--------------------*/
.wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  width: 369px;
  height: 547px;
  font-family: 'Source Sans Pro', sans-serif;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
  -webkit-transform: translate(-50%, -50%) perspective(600px) rotateY(20deg) rotateX(10deg);
          transform: translate(-50%, -50%) perspective(600px) rotateY(20deg) rotateX(10deg);
}

/*--------------------
Me
--------------------*/
.me {
  position: relative;
  width: 369px;
  height: 547px;
  -webkit-transform: translateZ(80px) scale(0.8);
          transform: translateZ(80px) scale(0.8);
}
.me::before, .me::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 10px;
  background: url("images/profile.png") no-repeat 0 0;
}
.me::after {
  height: 30px;
  top: auto;
  bottom: -15px;
  z-index: -1;
  -webkit-filter: blur(15px);
          filter: blur(15px);
  background-size: 100% 30px;
  border-radius: 100px;
}
.me .eye, .me .eye::before {
  width: 70px;
  height: 70px;
  position: absolute;
  top: 175px;
  left: 120px;
  z-index: -1;
  background: url(http://www.supah.it/dribbble/006/eye.png) no-repeat center;
}
.me .eye::before {
  content: '';
  top: -2px;
  left: 97px;
}

.text {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 390px;
  height: 595px;
  -webkit-transform: translateZ(150px) translateX(-11px) translateY(-26px) scale(0.55);
          transform: translateZ(150px) translateX(-11px) translateY(-26px) scale(0.55);
  border: 3px solid white;
  text-align: center;
  font-size: 100px;
  line-height: 1000px;
  color: white;
  background: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.36) 39%, rgba(255, 255, 255, 0.07) 41%, rgba(255, 255, 255, 0) 51%, black 100%);
  opacity: .3;
  border-radius: 8px;
}
.text::after {
  content: 'webdesigner';
  width: 100%;
  position: absolute;
  bottom: 22px;
  left: 0;
  width: 100%;
  z-index: 1;
  line-height: 1;
  font-size: 18px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 20px;
  text-indent: 20px;
}
.social-icons li {
    display: inline;
    padding-right: 10px;
}
.social-icons li a i {
    font-size:20px;
    color: #000;
}
ul.social-icons.list-inline {
    text-align: center;
}
       
       
       </style>
       
       
       
       
       
       
       
   </head>
   <body>
<div class="wrapper">
  <div class="card">
    <div class="me">
      <div class="eye"></div>
    </div>
    <div class="text">
      DEMON
    	
    </div>
  </div>
  <ul class="social-icons list-inline">
            <li><a href="#"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
            <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
            <li><a href="#"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
            <li><a href="#"><i class="fa fa-google-plus" aria-hidden="true"></i></a></li>
            <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
            
        </ul>
</div>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      
      <script>
       
       var $wrap = $('.wrapper'),
  $lEye = $('.eye'),
  lFollowX = 5,
  lFollowY = 10,
  x = 0,
  y = 0,
  friction = 1 / 12;

function animate() {
  x += (lFollowX - x) * friction;
  y += (lFollowY - y) * friction;

  $lEye.css({
    '-webit-transform': 'translate(' + -x + 'px, ' + -y + 'px)',
    '-moz-transform': 'translate(' + -x + 'px, ' + -y + 'px)',
    'transform': 'translate(' + -x + 'px, ' + -y + 'px)'
  });

  $wrap.css({
    'transform': 'translate(-50%, -50%) perspective(600px) rotateY(' + -x + 'deg) rotateX(' + y + 'deg)'
  });
  window.requestAnimationFrame(animate);
}

$(window).on('mousemove click', function(e) {

  var lMouseX = Math.max(-100, Math.min(100, $(window).width() / 2 - e.clientX));
  var lMouseY = Math.max(-100, Math.min(100, $(window).height() / 2 - e.clientY));
  lFollowX = (12 * lMouseX) / 100; // 100 : 12 = lMouxeX : lFollow
  lFollowY = (10 * lMouseY) / 100;

});

animate();
       </script>
      
   
      
   </body>
</html>

在线演示


让链接同时具备两种打开方式
获取源码: Goggle
下载数:98人次, 文件大小: 299.7 KB, 上传日期: 2020年-11 月-25日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

2,628 人查阅

类似文章