css实现点状时钟走动动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现点状时钟走动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --bg: #e3e4e8; --fg: #17181c; font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320)); } body { background: var(--bg); color: var(--fg); display: grid; font: 1em/1.5 sans-serif; place-items: center; height: 100vh; } .pl { position: relative; width: 12em; height: 12em; } .pl__dot { background: currentColor; position: absolute; top: calc(50% - 0.5em); left: calc(50% - 0.25em); width: 0.5em; height: 0.5em; transform-origin: 50% 100%; } .pl__dot:nth-child(1) { animation: dot1 8s linear infinite; transform: rotate(0deg) translateY(-5.5em); } .pl__dot:nth-child(2) { animation: dot2 8s linear infinite; transform: rotate(30deg) translateY(-5.5em); } .pl__dot:nth-child(3) { animation: dot3 8s linear infinite; transform: rotate(60deg) translateY(-5.5em); } .pl__dot:nth-child(4) { animation: dot4 8s linear infinite; transform: rotate(90deg) translateY(-5.5em); } .pl__dot:nth-child(5) { animation: dot5 8s linear infinite; transform: rotate(120deg) translateY(-5.5em); } .pl__dot:nth-child(6) { animation: dot6 8s linear infinite; transform: rotate(150deg) translateY(-5.5em); } .pl__dot:nth-child(7) { animation: dot7 8s linear infinite; transform: rotate(180deg) translateY(-5.5em); } .pl__dot:nth-child(8) { animation: dot8 8s linear infinite; transform: rotate(210deg) translateY(-5.5em); } .pl__dot:nth-child(9) { animation: dot9 8s linear infinite; transform: rotate(240deg) translateY(-5.5em); } .pl__dot:nth-child(10) { animation: dot10 8s linear infinite; transform: rotate(270deg) translateY(-5.5em); } .pl__dot:nth-child(11) { animation: dot11 8s linear infinite; transform: rotate(300deg) translateY(-5.5em); } .pl__dot:nth-child(12) { animation: dot12 8s linear infinite; transform: rotate(330deg) translateY(-5.5em); } /* Dark theme */ @media (prefers-color-scheme: dark) { :root { --bg: #17181c; --fg: #e3e4e8; } } /* Animations */ @keyframes dot1 { 0% { transform: rotate(0deg) translateY(-5.5em); } 4.1666666667% { transform: rotate(30deg) translateY(0em); } 50% { transform: rotate(360deg) translateY(0em); } 95.8333333333% { transform: rotate(690deg) translateY(0em); } 100% { transform: rotate(690deg) translateY(-5.5em); } } @keyframes dot2 { 0%, 4.1666666667% { transform: rotate(30deg) translateY(-5.5em); } 8.3333333333% { transform: rotate(60deg) translateY(-0.5em); } 50% { transform: rotate(360deg) translateY(-0.5em); } 91.6666666667% { transform: rotate(660deg) translateY(-0.5em); } 95.8333333333%, 100% { transform: rotate(660deg) translateY(-5.5em); } } @keyframes dot3 { 0%, 8.3333333333% { transform: rotate(60deg) translateY(-5.5em); } 12.5% { transform: rotate(90deg) translateY(-1em); } 50% { transform: rotate(360deg) translateY(-1em); } 87.5% { transform: rotate(630deg) translateY(-1em); } 91.6666666667%, 100% { transform: rotate(630deg) translateY(-5.5em); } } @keyframes dot4 { 0%, 12.5% { transform: rotate(90deg) translateY(-5.5em); } 16.6666666667% { transform: rotate(120deg) translateY(-1.5em); } 50% { transform: rotate(360deg) translateY(-1.5em); } 83.3333333333% { transform: rotate(600deg) translateY(-1.5em); } 87.5%, 100% { transform: rotate(600de.........完整代码请登录后点击上方下载按钮下载查看
网友评论0