div+css实现圆形线圈转动动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现圆形线圈转动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --s: 1s; /*speed*/ --d: 10; /*delay*/ --c: #ff2525; /*color*/ } * { transform-style: preserve-3d; box-sizing: border-box; } body { margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; perspective: 1000vmin; background: radial-gradient(circle at 50% 100%, #101010, #000); } .sphere { width: 50vmin; height: 50vmin; background: #ffF0; position: relative; animation: spin 5s linear 0s infinite; animation-play-state: running; display: flex; align-items: center; justify-content: center; cursor: none; position: absolute; z-index: 2; } .sphere:hover { animation-play-state: paused; } @keyframes spin { 0% { transform: rotateX(-210deg) rotateY(0deg) rotatez(185deg); } 100% { transform: rotateX(-210deg) rotateY(360deg) rotatez(185deg); } } .sphere div { --sz: 23%; --dv: calc(var(--s) / var(--d)); --dl: calc(var(--dv) * -1); width: var(--sz); height: var(--sz); position: absolute; border: 0.25vmin solid var(--c); border-radius: 100%; transform: rotateX(90deg) translateZ(23.75vmin); box-shadow: 0 0 0.125vmin 0.125vmin var(--c), 0 0 0.125vmin 0.125vmin var(--c) inset; animation: shine var(--s) linear var(--dl) infinite alternate; background: #fff0; } @keyframes shine { 0%, 50%, 100% { border-color: var(--c); box-shadow: 0 0 0.125vmin 0.125vmin var(--c), 0 0 0.125vmin 0.125vmin var(--c) inset; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0