<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">
@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;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.