Skip to content

Instantly share code, notes, and snippets.

@Jubin369
Last active April 1, 2018 06:04
Show Gist options
  • Save Jubin369/662f57b8a93d26d4d0b09af8bce6c235 to your computer and use it in GitHub Desktop.
Save Jubin369/662f57b8a93d26d4d0b09af8bce6c235 to your computer and use it in GitHub Desktop.
User Profile : code from Fabio Ottaviani
<div class="wrapper">
<div class="card">
<div class="me">
<div class="eye"></div>
</div>
<div class="text">
JuBin
</div>
</div>
</div>
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 src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
/*--------------------
Body
--------------------*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html, body {
height: 100%;
background: #f5f9fd;
}
/*--------------------
Mixins
--------------------*/
@mixin center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/*--------------------
Wrapper
--------------------*/
.wrapper {
@include center;
width: 369px;
height: 547px;
font-family: 'Source Sans Pro', sans-serif;
transform-style: preserve-3d;
transform: translate(-50%, -50%) perspective(600px) rotateY(20deg) rotateX(10deg);
}
/*--------------------
Me
--------------------*/
.me {
position: relative;
width: 369px;
height: 547px;
transform: translateZ(80px) scale(.8);
&::before, &::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: 10px;
background: url('https://lh3.googleusercontent.com/8nvciEYnhXD7V9qy-8aN0wJU1VJBQ8_GfcuPuwjvZJrq4s1YVWWV9zSba8JcNi9l1jUwblss4Mow5SeWl8cUJWEKuwJIo6mLMRf_RlHMByKBE5BWJDKm-7MerOChOww_ilgb7B0hm-PhLTWUjqBKpDwj_RuDDwTuFKDqL3E0qH-E0blMHjMf04Y0WN4bvy2BPWZAuFbbfUjf7UTkOnYJumrL14Y5vO7rM7UWCBk98NVZWjATjnDKzRZABCNRjjCBPJnUs-flYoH6T7Qb_h78twTIY9-9om7kDr0imQVYg-T9MSigsh6SJlBG09eKXNAiboJWtG-MrUiw4j7G5M7H_lI7kqgCTMvmg6auDlR1eXBHx9UUlHGOiP6dfCyq4U_xuvtAkaf7JzZhWmWdToCEdvlh6T2goPXeLZOw13DaPWLs31uI0D8iHIaj5bPNV1cVp2rdwB8dLfbnHv9dG4moZpC1RtN1MMXtRT5DjdwD5KACsa26HMOJ49l5jb7jXxrUUtsg8ubJMm5vxP6NMmmyZgVi9ViHfPvgRojJG_rEueIR__UJdakBHa-Kc0tDsWw8KjuYcaI48TODaesY8pspEI1ykuEHfE_gIIWaL6E=w339-h493-no') no-repeat 0 0;
}
background-size:contain;
&::after {
height: 30px;
top: auto;
bottom: -15px;
z-index: -1;
filter: blur(15px);
background-size: 100% 30px;
border-radius: 100px;
}
.eye, .eye::before {
width: 70px;
height: 70px;
position: absolute;
top: 175px;
left: 70px;
z-index: -1;
background: url(http://www.supah.it/dribbble/006/eye.png) no-repeat center;
}
.eye::before {
content: '';
top: -7px;
left: 116px;
}
}
.text {
position: absolute;
top: 0;
left: 0;
z-index: 2;
width: 390px;
height: 595px;
transform: translateZ(150px) translateX(-11px) translateY(-26px) scale(.55);
border: 3px solid rgba(255, 255, 255, 1);
text-align: center;
font-size: 100px;
line-height: 1000px;
color: rgba(255, 255, 255, 1);
background: linear-gradient(135deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0.36) 39%,rgba(255,255,255,0.07) 41%,rgba(255,255,255,0) 51%,rgba(0,0,0,1) 100%);
opacity: .3;
border-radius: 8px;
&::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;
}
}
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment