Делаем разметку с помощью HTML:
Пишем стиль:
Придаем динамики и эффектов:
Смотрим полученный результат:
HTML:
<div class="frame flex">
<div class="center">
<div class="profile">
<div class="image">
<div class="circle-1"></div>
<div class="circle-2"></div>
<img src="http://100dayscss.com/codepen/jessica-potter.jpg" alt="Jessica Potter" width="70" height="70">
</div>
<div class="name">Jessica Potter</div>
<div class="job">Web developer</div>
<div>
<svg xmlns="http://www.w3.org/2000/svg"
width="40px" height="30px"
viewBox="5 0 80 60">
<path id="wave"
fill="none"
stroke="#262626"
stroke-width="2"
stroke-linecap="round">
</path>
</svg>
</div>
<div class="actions">
<button class="btn">Follow</button>
<button class="btn">Message</button>
</div>
</div>
<div class="stats">
<div class="box box1">
<span class="value odometer">523</span>
<span class="parameter">Posts</span>
</div>
<div class="box box2">
<span class="value">1387</span>
<span class="parameter">Likes</span>
</div>
<div class="box box3">
<span class="value">146</span>
<span class="parameter">Followers</span>
</div>
</div>
</div>
</div>
SCSS:
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans|Josefin+Slab|Lobster');
body {
background: #201c29;
}
.frame {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 400px;
margin-top: -200px;
margin-left: -200px;
border-radius: 2px;
box-shadow: .5rem .5rem 1rem rgba(0, 0, 0, 0.6);
background: #643a7a;
color: #786450;
font-family: 'Josefin slab', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.flex {
display: flex;
justify-content: center;
align-items: center;
}
.center {
height: 299px;
width: 320px;
background: #fff;
border-radius: 6px;
overflow: hidden;
box-shadow: .5rem .5rem 1rem rgba(0, 0, 0, 0.5);
}
.profile {
float: left;
width: 200px;
height: 320px;
text-align: center;
}
.profile .image {
position: relative;
width: 80px;
height: 70px;
margin: 38px auto 0 auto;
}
.profile .image .circle-1, .profile .image .circle-2 {
position: absolute;
box-sizing: border-box;
width: 76px;
height: 76px;
top: -3px;
left: -3px;
border-width: 1px;
border-style: solid;
border-color: #643a7a #643a7a #643a7a transparent;
border-radius: 50%;
transition: all 1.5s ease-in-out;
}
.circle-1 {
animation: circle-1 2s;
}
@keyframes circle-1 {
100% {
transform: rotate(-360deg);
}
}
.profile .image .circle-2 {
width: 82px;
height: 82px;
top: -6px;
left: -6px;
border-color: #786450 transparent #786450 #786450;
animation: circle 2s;
}
@keyframes circle {
100% {
transform: rotate(360deg);
}
}
.profile .image img {
display: block;
border-radius: 50%;
background: #F5E8DF;
}
.profile .image:hover {
cursor: pointer;
}
.profile .image:hover .circle-1, .profile .image:hover .circle-2 {
transform: rotate(360deg);
}
.profile .image:hover .circle-2 {
transform: rotate(-360deg);
}
.profile .name {
font-size: 2rem;
margin-top: 20px;
}
.profile .job {
font-size: 1.2rem;
line-height: 15px;
}
svg {
margin: 0 auto;
overflow: hidden;
}
#wave {
stroke-dasharray: 0 16 101 16;
animation: moveTheWave 2400ms linear infinite;
}
@keyframes moveTheWave {
0% {
stroke-dashoffset: 0;
transform: translate3d(0, 0, 0);
}
100% {
stroke-dashoffset: -133;
transform: translate3d(-90px, 0, 0);
}
}
.profile .actions .btn {
display: block;
width: 80px;
height: 30px;
margin: 0 auto 10px auto;
background: none;
border: 2px solid transparent;
font-size: 1.1rem;
box-sizing: border-box;
transition: all .3s ease-in-out;
color: #643a7a;
}
.btn, .parameter {
font-family: 'Josefin sans';
}
.profile .actions .btn:hover {
border-bottom: 2px solid #643a7a;
cursor: pointer;
}
.stats {
float: left;
}
.stats .box {
box-sizing: border-box;
width: 120px;
height: 99px;
background: #F5E8DF;
text-align: center;
padding-top: 28px;
transition: all .4s ease-in-out;
color: #643a7a;
}
.box1 {
animation: bg .5s ease-in-out;
}
.box2 {
animation: bg .8s ease-in-out;
}
.box3 {
animation: bg 1.1s ease-in-out;
}
@keyframes bg {
0% {
transform: translate(8rem);
}
100% {
transform: translate(0);
}
}
.stats .box:hover {
background: fade-out(#643a7a, .4);
transition: 1s;
cursor: pointer;
color: #fff;
}
.stats .box:nth-child(2) {
margin: 1px 0;
}
.stats span {
display: block;
}
.stats .value {
font-size: 1.8rem;
font-family: lobster;
}
.stats .parameter {
font-size: 1rem;
line-height: 1.2;
}
JavaScript:
const path = document.querySelector('#wave');
const animation = document.querySelector('#moveTheWave');
const m = 0.512286623256592433;
function buildWave(w, h) {
const a = h / 4;
const y = h / 2;
const pathData = [
'M', w * 0, y + a / 2,
'c',
a * m, 0,
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a,
's',
-(1 - a) * m, a,
a, a,
's',
-(1 - a) * m, -a,
a, -a
].join(' ');
path.setAttribute('d', pathData);
}
buildWave(90, 60);