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 { --hue: 223; --bg: hsl(var(--hue),10%,90%); --fg: hsl(var(--hue),10%,10%); font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320)); } body { background-color: var(--bg); color: var(--fg); font: 1em/1.5 sans-serif; height: 100vh; display: grid; place-items: center; transition: background-color 0.3s; } main { padding: 1.5em 0; } .ap { width: 8em; height: 16em; } .ap__ring { stroke: hsla(var(--hue),10%,10%,0.15); transition: stroke 0.3s; } .ap__worm1, .ap__worm2 { animation-duration: 3s; animation-iteration-count: infinite; } .ap__worm1 { animation-name: worm1; } .ap__worm2 { animation-name: worm2; visibility: hidden; } /* Dark theme */ @media (prefers-color-scheme: dark) { :root { --bg: hsl(var(--hue),10%,10%); --fg: hsl(var(--hue),10%,90%); } .ap__ring { stroke: hsla(var(--hue),10%,90%,0.1); } } /* Animtions */ @keyframes worm1 { from { animation-timing-function: ease-in-out; stroke-dashoffset: -87.96; } 20% { animation-timing-function: ease-in; stroke-dashoffset: 0; } 60% { stroke-dashoffset: -791.68; visibility: visible; } 60.1%, to { stroke-dashoffset: -791.68; visibility: hidden; } } @keyframes worm2 { from, 60% { stroke-dashoffset: -87.96; visibility: hidden; } 6.........完整代码请登录后点击上方下载按钮下载查看
网友评论0