html and css3 js制作逗比效果前端只有你想不到没有它做不到的id1101-网页前端设计
源码下载地址
在新演示地址
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>
点赞 评论 转发就是对up的最大支持和鼓励, 非常谢谢!