div+css绘制走出黑暗对数螺旋线旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css绘制走出黑暗对数螺旋线旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<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: 0.5s;
white-space: nowrap;
}
#btn--yp:before {
box-sizing: inherit;
position: absolute;
left: 0;
bottom: 100%;
margin: 1em -0.5em;
padding: 0.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 {
display: grid;
place-content: center;
overflow: hidden;
margin: 0;
height: 100vh;
background: radial-gradient(circle closest-side, #000, #fff);
}
.dot {
--k: calc(var(--i)/var(--n-arms));
grid-area: 1/1;
place-self: center;
padding: var(--c);
border-radius: 50%;
transform: rotate(calc(var(--k)*1turn + var(--j)*var(--u))) translate(var(--r0)) scale(calc(min(1, var(--j))*var(--f0)));
opacity: calc(1 - var(--j)/var(--n-dots));
background: hsl(calc(var(--k)*360), 97%, 63%);
animation: a 1s linear infinite;
}
@keyframes a {
to {
transform: rotate(calc(var(--k)*1turn + (var(--j) + 1)*var(--u))) translate(var(--r1)) scale(var(--f1));
opacity: calc(1 - (var(--j) + 1)/var(--n-dots));
}
}
</style>
</head>
<body style="--n-dots: 50; --n-arms: 7;
--u: 15deg; --c: 3px">
<style>.dot:nth-of-type(n + 1) { --i: 0 }.dot:nth-of-type(n + 51) { --i: 1 }.dot:nth-of-type(n + 101) { --i: 2 }.dot:nth-of-type(n + 151) { --i: 3 }.dot:nth-of-type(n + 201) { --i: 4 }.dot:nth-of-type(n + 251) { --i: 5 }.dot:nth-of-type(n + 301) { --i: 6 }.dot:nth-of-type(50n + 1) {
--j: 0;
--r0: 24px;
--f0: 1.07;
--r1: 26px;
--f1: 1.14
}.dot:nth-of-type(50n + 2) {
--j: 1;
--r0: 26px;
--f0: 1.14;
--r1: 28px;
--f1: 1.22
}.dot:nth-of-type(50n + 3) {
--j: 2;
--r0: 28px;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0