css实现圆片切割loading加载动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:css实现圆片切割loading加载动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --hue: 223; --bg: hsl(var(--hue),90%,90%); --fg: hsl(var(--hue),90%,10%); --trans-dur: 0.3s; --trans-timing: cubic-bezier(0.65,0,0.35,1); font-size: calc(14px + (60 - 14) * (100vw - 280px) / (3840 - 280)); } body { background-color: var(--bg); color: var(--fg); display: flex; font: 1em/1.5 sans-serif; height: 100vh; transition: background-color var(--trans-dur), color var(--trans-dur); } .pl { margin: auto; perspective: 8em; position: relative; width: 11em; height: 2em; } .pl, .pl__chip { transform-style: preserve-3d; } .pl__chip { position: absolute; top: 0; right: 0; width: 2em; height: 2em; transform: translateX(50%) rotateY(90deg); } .pl__chip, .pl__chip:before { animation: 2s move-left var(--trans-timing) infinite; } .pl__chip:before { background-color: hsl(var(--hue), 90%, 50%); border-radius: 50%; content: ""; display: block; opacity: 0.8; width: 100%; height: 100%; transform: rotateZ(45deg); } .pl__chip:nth-child(3n+2):before { background-color: #f2b10d; } .pl__chip:nth-child(1) { right: 0em; } .pl__chip:nth-child(1):before { animation-name: roll-right-1; } .pl__chip:nth-child(2) { right: 1em; } .pl__chip:nth-child(2):before { animation-name: roll-right-2; } .pl__chip:nth-child(3) { right: 2em; } .pl__chip:nth-child(3):before { animation-name: roll-right-3; } .pl__chip:nth-child(4) { right: 3em; } .pl__chip:nth-child(4):before { animation-name: roll-right-4; } .pl__chip:nth-child(5) { right: 4em; } .pl__chip:nth-child(5):before { animation-name: roll-right-5; } .pl__chip:nth-child(6) { right: 5em; } .pl__chip:nth-child(6):before { animation-name: roll-right-6; } .pl__chip:nth-child(7) { right: 6em; } .pl__chip:nth-child(7):before { animation-name: roll-right-7; } .pl__chip:nth-child(8) { right: 7em; } .pl__chip:nth-child(8):before { animation-name: roll-right-8; } .pl__chip:nth-child(9) { right: 8em; } .pl__chip:nth-child(9):before { animation-name: roll-right-9; } .pl__chip:nth-child(10) { right: 9em; } .pl__chip:nth-child(10):before { animation-name: roll-right-10; } .pl__chip:nth-child(11) { right: 10em; } .pl__chip:nth-child(11):before { animation-name: roll-right-11; } .pl__chip:nth-child(12) { right: 11em; } .pl__chip:nth-child(12):before { animation-name: roll-right-12; } /* Dark theme */ @media (prefers-color-scheme: dark) { :root { --bg: hsl(var(--hue),90%,10%); --fg: hsl(var(--hue),90%,90%); } } /* Animations */ @keyframes move-left { from { transform: translateX(50%) rotateY(90deg); } to { transform: translateX(-100%) rotateY(90deg); } } @keyframes roll-right-1 { from { transform: translateZ(0) rotateZ(45deg) rotateX(0); } 50%, .........完整代码请登录后点击上方下载按钮下载查看
网友评论0