Open klren0312 opened 1 year ago
<div class="block"> <div class="block-loading"> <div class="block-loading-block"> <div class="block-loading-blank"> </div> <div class="block-loading-inner"></div> </div> </div> </div>
body { background: #333; } .block { position: relative; width: 675px; height: 422px; } .block-loading { position: absolute; left: 0; right: 0; width: 100%; height: 100%; border-radius: 5px; transform-style: preserve-3d; } .block-loading-block { width: 100%; height: 100%; transition: 5s cubic-bezier(0.4,0,0.2,1); transition-property: color,filter,transform; -webkit-appearance: none; -moz-appearance: none; appearance: none; position: relative; border: 0; font: inherit; overflow: hidden; margin: calc(5px * 0); padding: 5px; color: #a1a1aa; border-radius: 0.5rem; transform: none; user-select: none; will-change: transform; background-color: rgba(255 255 255 0); min-width: 8rem; box-sizing: border-box; } .block-loading-blank { width: 100%; height: 100%; display: inline-flex; position: relative; background-image: linear-gradient(to top right,rgba(1 1 1 0.9),#141414); background-color: #141414; justify-content: center; /* padding: 0.625rem 1rem; */ text-align: center; z-index: 10; border-radius: 0.75rem; } .block-loading-inner { position: absolute; width: 100%; inset: 0; height: 100%; top: 50%; border-radius: 5px; transform: translateY(-50%) scaleY(4) scaleX(4); will-change: transform; z-index: 2; } .block-loading-inner::before { content: ''; width: 100%; position: absolute; left: 0; min-height: 100%; top: 50%; aspect-ratio: 1/1; transform-origin: center; background-image: conic-gradient(#f9dcdd 0deg,#c1a4e8 60deg,transparent 100deg,transparent 130deg,transparent 160deg,#f2efe8 190deg,#b8e2fb 230deg,transparent 270deg); opacity: var(1, 0); filter: blur(8px); animation: AnimationInner 2.5s linear infinite; animation-play-state: var(running, paused); transition: 5s cubic-bezier(0.4, 0, 0, 2, 1); transition-property: opacity; } @keyframes AnimationInner { 0% { transform: translateY(-50%) rotate(0deg) } to { transform: translateY(-50%) rotate(1turn) } }
https://codepen.io/klren0312/pen/vYvWbWj
codepen
https://codepen.io/klren0312/pen/vYvWbWj