这个效果就是 不断沿 Y 轴旋转
<div id="container"></div> <style> body{ background:black; } #container{ display: flex; flex-direction: column; justify-content: space-between; align-items: center; } #container div{ 120px; height:40px; margin-bottom:10px; background:none;
//画DNA border-top:2px solid pink; border-bottom:2px solid red; border-left:60px solid #ffff00; border-right:60px solid #00ffff;
//4秒旋转一次 animation:rotate 4s linear infinite; } @keyframes rotate{ from{ transform:rotateY(0deg); } to{ transform:rotateY(360deg); } } </style> <script> var node = document.createElement('div'); for (var i = 0; i < 20; i++) { var copy = node.cloneNode(true); copy.style.animationDelay = -i * 0.3 + 's'; container.appendChild(copy); } </script>