div+css实现dna螺旋动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现dna螺旋动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
:root {
--color-primary: #00d9ff;
--color-secondary: #ec1583;
--color-tertiary: #deee75;
--color-quaternary: #9375ee;
--color-surface: #191919;
}
@property --rotate-y {
syntax: "<angle>";
inherits: true;
initial-value: 0deg;
}
@property --rotate {
syntax: "<angle>";
inherits: true;
initial-value: 45deg;
}
@property --gap {
syntax: "<length>";
inherits: true;
initial-value: 0;
}
@-webkit-keyframes dna {
from {
--rotate-y: 0deg;
}
to {
--rotate-y: 360deg;
}
}
@keyframes dna {
from {
--rotate-y: 0deg;
}
to {
--rotate-y: 360deg;
}
}
@-webkit-keyframes rotate-container {
from {
--rotate: 42deg;
}
50% {
--rotate: 142deg;
}
to {
--rotate: 42deg;
}
}
@keyframes rotate-container {
from {
--rotate: 42deg;
}
50% {
--rotate: 142deg;
}
to {
--rotate: 42deg;
}
}
.container {
filter: url(#blurFilter) contrast(1.5) brightness(1.5) saturate(0.6);
position: absolute;
transform: scale(0.8);
}
.dna {
--width: 11rem;
--count: 42;
display: flex;
flex-direction: column;
z-index: 1111;
perspective: 50rem;
-webkit-animation: dna 2.5s linear infinite, rotate-container 20s ease-in-out infinite;
animation: dna 2.5s linear infinite, rotate-container 20s ease-in-out infinite;
transform-style: preserve-3d;
rotate: var(--rotate);
transform: rotateY(var(--rotate-y, 0deg));
}
@media (prefers-reduced-motion) {
.dna {
-webkit-animation: dna 2.5s linear infinite;
animation: dna 2.5s linear infinite;
}
}
.dna .item {
display: flex;
align-items: center;
transform-style: preserve-3d;
--a: calc(360deg / var(--count) * (var(--i)));
transform: rotateY(var(--a));
}
.dna .item > div {
width: var(--width);
height: 0.381rem;
background: white;
background: conic-gradient(var(--color-primary), var(--color-secondary));
transform-style: preserve-3d;
}
.dna .item > div:first-of-type, .dna .item > div:last-of-type {
--thickness: 0.9rem;
width: var(--thickness);
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0