Hover effektek
Fényből rajzolódó keret
Élő előnézet – az animáció teljes méretben.
Élő előnézet
HTML · CSS · JS
<div class="we-hover-frame">
<div class="we-frame-line we-frame-top"></div>
<div class="we-frame-line we-frame-right"></div>
<div class="we-frame-line we-frame-bottom"></div>
<div class="we-frame-line we-frame-left"></div>
<div class="we-frame-content">
<span>WebElements</span>
<strong>
Fényből rajzolva
</strong>
<small>
A keret hoverre születik meg
</small>
</div>
</div>
.we-hover-frame {
width: 100%;
max-width: 440px;
height: 190px;
margin: 60px auto;
position: relative;
overflow: hidden;
display: flex;
align-items: center;
padding: 40px;
box-sizing: border-box;
background: #0a1014;
border: 1px solid rgba(142,232,212,.12);
border-radius: 18px;
color: #f2f4f0;
font-family: Arial, sans-serif;
transition:
transform .45s cubic-bezier(.22,1,.36,1),
box-shadow .45s ease;
}
/* ALAP KERET ELTŰNIK */
.we-frame-line {
position: absolute;
z-index: 3;
background: #8ee8d4;
box-shadow:
0 0 8px rgba(142,232,212,1),
0 0 22px rgba(142,232,212,.65);
opacity: 0;
}
/* FELSŐ */
.we-frame-top {
top: 0;
left: 0;
width: 0;
height: 2px;
}
/* JOBB */
.we-frame-right {
top: 0;
right: 0;
width: 2px;
height: 0;
}
/* ALSÓ */
.we-frame-bottom {
bottom: 0;
right: 0;
width: 0;
height: 2px;
}
/* BAL */
.we-frame-left {
bottom: 0;
left: 0;
width: 2px;
height: 0;
}
/* TARTALOM */
.we-frame-content {
position: relative;
z-index: 2;
transition:
transform .5s cubic-bezier(.22,1,.36,1);
}
.we-frame-content span {
display: block;
margin-bottom: 12px;
font-size: 11px;
letter-spacing: 4px;
text-transform: uppercase;
color: #8ee8d4;
}
.we-frame-content strong {
display: block;
font-size: 27px;
font-weight: 500;
}
.we-frame-content small {
display: block;
margin-top: 10px;
font-size: 13px;
color: rgba(242,244,240,.62);
}
/* HOVER */
.we-hover-frame:hover {
transform: translateY(-6px);
box-shadow:
0 24px 55px rgba(0,0,0,.5),
0 0 30px rgba(142,232,212,.10);
}
/* KERET KIRAJZOLÁSA */
.we-hover-frame:hover .we-frame-top {
animation:
frameTop
.35s
ease-out
forwards;
}
.we-hover-frame:hover .we-frame-right {
animation:
frameRight
.35s
ease-out
.35s
forwards;
}
.we-hover-frame:hover .we-frame-bottom {
animation:
frameBottom
.35s
ease-out
.70s
forwards;
}
.we-hover-frame:hover .we-frame-left {
animation:
frameLeft
.35s
ease-out
1.05s
forwards;
}
.we-hover-frame:hover .we-frame-content {
transform:
translateY(-3px)
scale(1.015);
}
/* ANIMÁCIÓK */
@keyframes frameTop {
0% {
width: 0;
opacity: 1;
}
100% {
width: 100%;
opacity: 1;
}
}
@keyframes frameRight {
0% {
height: 0;
opacity: 1;
}
100% {
height: 100%;
opacity: 1;
}
}
@keyframes frameBottom {
0% {
width: 0;
opacity: 1;
}
100% {
width: 100%;
opacity: 1;
}
}
@keyframes frameLeft {
0% {
height: 0;
opacity: 1;
}
100% {
height: 100%;
opacity: 1;
}
}
Ehhez az animációhoz nincs külön JavaScript.