Hover effektek
Hover – Fényfolyosó
Élő előnézet – az animáció teljes méretben.
Élő előnézet
HTML · CSS · JS
<div class="we-hover-light">
<span class="we-hover-light-label">
WebElements
</span>
<strong>
Fényfolyosó
</strong>
<small>
Vidd fölé az egeret
</small>
</div>
.we-hover-light {
width: 100%;
max-width: 440px;
height: 190px;
margin: 60px auto;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
padding: 35px 40px;
box-sizing: border-box;
background:
radial-gradient(
circle at 50% 50%,
rgba(142,232,212,.08),
transparent 60%
),
#0b1014;
border: 1px solid rgba(142,232,212,.22);
border-radius: 18px;
color: #f2f4f0;
font-family: Arial, sans-serif;
transition:
transform .45s cubic-bezier(.22,1,.36,1),
border-color .45s ease,
box-shadow .45s ease;
}
/* FÉNYCSÍK */
.we-hover-light::before {
content: "";
position: absolute;
top: -30%;
left: -35%;
width: 22%;
height: 160%;
background: linear-gradient(
90deg,
transparent,
rgba(142,232,212,.15),
rgba(255,255,255,.85),
rgba(142,232,212,.15),
transparent
);
transform: skewX(-18deg) translateX(-250%);
opacity: 0;
}
/* FINOM BELSŐ FÉNY */
.we-hover-light::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background:
radial-gradient(
circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
rgba(142,232,212,.12),
transparent 35%
);
opacity: 0;
transition: opacity .4s ease;
pointer-events: none;
}
/* HOVER */
.we-hover-light:hover {
transform: translateY(-7px);
border-color: rgba(142,232,212,.65);
box-shadow:
0 18px 45px rgba(0,0,0,.45),
0 0 30px rgba(142,232,212,.10);
}
.we-hover-light:hover::before {
opacity: 1;
animation:
weLightPass
.9s
cubic-bezier(.22,1,.36,1)
forwards;
}
.we-hover-light:hover::after {
opacity: 1;
}
/* SZÖVEG */
.we-hover-light-label {
position: relative;
z-index: 2;
margin-bottom: 12px;
font-size: 11px;
letter-spacing: 4px;
text-transform: uppercase;
color: #8ee8d4;
}
.we-hover-light strong {
position: relative;
z-index: 2;
font-size: 27px;
font-weight: 500;
}
.we-hover-light small {
position: relative;
z-index: 2;
margin-top: 10px;
font-size: 13px;
color: rgba(242,244,240,.62);
}
/* FÉNY ÁTSZALAD */
@keyframes weLightPass {
0% {
transform: skewX(-18deg) translateX(-250%);
}
100% {
transform: skewX(-18deg) translateX(700%);
}
}
Ehhez az animációhoz nincs külön JavaScript.