Светящиеся границы: магия движения и плавная остановка
See the Pen Glowing border animation on hover with a smooth stop by Temani Afif (@t_afif) on CodePen.
HTML
<img src="https://picsum.photos/id/58/300/300" alt="a lighthouse">
<img src="https://picsum.photos/id/61/300/300" class="alt" alt="an old city">
CSS
@property --a {syntax: "<angle>";inherits: false;initial-value: 0deg;}@property --i {syntax: "<number>";inherits: false;initial-value: 0;}img {width: 230px;aspect-ratio: 1;border-radius: 30px;border: 5px solid #ccc;padding: 10px; /* control the gap */mask:conic-gradient(#000 0 0) content-box,linear-gradient(calc(mod(var(--a),180deg)*var(--i) + var(--_a,45deg)),#0000 30%,#000 40% 60%,#0000 70%) subtract,conic-gradient(#000 0 0) padding-box;transition: --i .5s,--a 0s .5s;cursor: pointer;}img.alt {--_a: -45deg;}img:hover {--i: 1;--a: 15turn;transition: --i 0s,--a 30s linear;}body {margin: 0;min-height: 100vh;display: grid;place-content: center;grid-auto-flow: column;gap: 50px;background: #000;}
glowing-border-animation-on-hover-with-a-smooth-stop.zip
0
4.93 Kb
Нашли ошибку? Сообщите нам, мы исправим!
Комментариев нет
Чтобы оставить комментарий, необходимо на сайте.