纯css实现万圣节拉链拉动动画效果代码
代码语言:html
所属分类:动画
代码描述:纯css实现万圣节拉链拉动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <style> #btn--yp { box-sizing: content-box; position: fixed; z-index: 9; bottom: 1em; right: 1em; border: solid 1em transparent; width: 4.625em; height: 3.25em; font: 16px/ 1.25 trebuchet ms, sans-serif; text-indent: 200vw; text-shadow: none; filter: grayscale(1) drop-shadow(0 0 1px #e8e0e0); transition: .5s; white-space: nowrap; } #btn--yp:before { box-sizing: inherit; position: absolute; left: 0; bottom: 100%; margin: 1em -.5em; padding: .5em; width: 100%; border-radius: 5px; background: #e8e0e0; color: #000; text-align: center; text-decoration: none; text-indent: 0vw; white-space: normal; animation: float 1s ease-in-out infinite alternate; content: attr(data-txt); } #btn--yp:hover, #btn--yp:focus { outline: none; filter: grayscale(0) drop-shadow(0 0 1px crimson); } @keyframes float { to { transform: translateY(0.75em); } } body { background: #130912; } .seg { display: flex; position: absolute; top: 50%; left: 50%; width: 5em; height: 6px; transform: translate(-50%, -50%) rotate(calc(var(--k)/var(--n)*1turn)) translate(calc(6px/var(--tan) + .5*5em)); } .seg::before, .seg::after { --i: 0; --sgn-i: calc(1 - 2*var(--i)); flex: 1; margin: 0 1px; border-radius: 3px; transform-origin: calc(var(--i)*100%); background: linear-gradient(calc(var(--sgn-i)*-90deg), #3e1c33, #602749, #b14623, #f6921d); animation: zip 1s ease-out calc((var(--k)/var(--n) - 1)*2*1s) infinite alternate; content: ""; } .seg::after { --i: 1 ; } @keyframes zip { 0%, 50% { transform: none; } 75%, 100% { transform: rotate(calc(var(--sgn-i)*68deg)); } } </style> </head> <body style="--n: 64; --tan: 0.049126849769467254"> <div class="seg" style="--k: 63"></div> <div class="seg" style="--k: 62"></div> <div class="seg" style="--k: 61"></div> <div class="seg" style="--k: 60"></div> <div class="seg" style="--k: 59"></div> <div class="seg" style="--k: 58"></div> <div class="seg" style="--k: 57"></div> <div class="seg" style="--k: 56"></div> <div class="seg" style="--k: 55"></div> <div class="seg" style="--k: 54"></div> <div class="seg" style="--k: 53"></div> <div class="seg" style="--k: 52"></div> <div class="seg" style="--k: 51"></div> <div class="seg" style="--k: 50"></div> <div class="seg" style="--k: 49"></div> <div class="seg" style="--k: 48"></div> <div class="seg" style="--k: 47"></div> <div class="seg" style="--k: 46"></div> <div class="seg" style="--k: 45"></div> <di.........完整代码请登录后点击上方下载按钮下载查看
网友评论0