Created
March 4, 2024 12:39
-
-
Save li-jia-nan/0b11839a46b2b7e652d960114f8b282f to your computer and use it in GitHub Desktop.
光圈
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property --gradientAngle { | |
syntax: "<percentage> | <angle>"; | |
inherits: false; | |
initial-value: 0deg; | |
} | |
.wapper { | |
width: 380px; | |
position: relative; | |
padding: 16px; | |
border-radius: 8px; | |
background-color: #fff; | |
border: 1px solid rgba(229, 229, 229, 1); | |
transition: all 0.3s linear; | |
z-index: 0; | |
&.isRunning { | |
position: relative; | |
--gradientAngle: 0deg; | |
transition: all 0.3s ease; | |
&::before { | |
position: absolute; | |
border-radius: 8px; | |
content: ""; | |
z-index: -2; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
transition: var(--gradientAngle) 0.3s linear; | |
border: 0 solid #e5e7eb; | |
box-sizing: border-box; | |
animation: angleChange 2s infinite linear; | |
background: linear-gradient(var(--gradientAngle), #0e42d2 36.34%, #fff 50.92%, #f0f0f0 63.72%), | |
linear-gradient(var(--gradientAngle), #0e42d2 2.22%, #fff 18.5%, #f0f0f0 32.77%); | |
} | |
&::after { | |
transition: var(--gradientAngle) 0.3s linear; | |
content: ""; | |
position: absolute; | |
background-color: #fff; | |
border-radius: 8px; | |
z-index: -1; | |
top: 2px; | |
right: 2px; | |
bottom: 2px; | |
left: 2px; | |
border: 0 solid #e5e7eb; | |
box-sizing: border-box; | |
} | |
} | |
} | |
@keyframes angleChange { | |
0% { | |
--gradientAngle: 0deg; | |
} | |
100% { | |
--gradientAngle: 360deg; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment