div+css实现原子核内部动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现原子核内部动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; padding: 0; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#FFF4 0%, transparent .0002%, transparent .075%, transparent .65%), repeating-conic-gradient(#FFF2 0%, transparent .0004%, transparent 0.05%, transparent .495%), radial-gradient(circle at 50% 50%, #121212, #000); perspective: 100vmin; } body * { transform-style: preserve-3d; } *::before { box-sizing: border-box; } h1 { position: absolute; top: 4vmin; color: #fff; font-family: Arial, serif; font-weight: normal; font-size: 3.5vmin; margin: 0; } .atom { width: 50vmin; height: 50vmin; display: flex; align-items: center; justify-content: center; border-radius: 100%; transition: 0.4s ease 0s; cursor: zoom-in; } .atom:active { transform: scale3d(1.5,1.5,1.5); } .atom:before { content: ""; width: 50vmin; height: 50vmin; position: absolute; background: radial-gradient(#913ab7 -50%, #fff0 50%); transform: translateZ(-6vmin); box-shadow: 0 0 5vmin -2vmin #cddc3920, 0 0 10vmin 0vmin #cddc3920, 0 0 10vmin 0vmin #39dcbe20, 0 0 10vmin 0 #cddc3920 inset, 0 0 25vmin 0 #39dcbe20 inset; border-radius: 100%; animation: orbit-cloud 3s ease 0s infinite alternate; opacity: 0.25; } @keyframes orbit-cloud { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(50deg);} } /*** NUCLEOUS ***/ .nucleous { width: 16vmin; height: 16vmin; display: flex; align-items: center; justify-content: center; border-radius: 100%; } .row { border-radius: 100%; transform: rotateX(80deg); position: absolute; width: 40%; height: 40%; margin-top: -8vmin; left: 33%; display: flex; align-items: center; justify-content: center; transform: rotateX(80deg) rotate(180deg); animation: orbit-nucleous 3s linear 0s infinite; } .row:nth-child(1) div:before { content: ""; position: absolute; width: 100%; height: 100%; border-radius: 100%; margin-top: -11vmin; background: red; background: radial-gradient(circle at 40% 60%, #fff0, 3vmin, #00000040 calc(3vmin + 1px) 100%), radial-gradient(circle at 28% 57%, #fff, 0.3vmin, #fff0 calc(0.3vmin + 1px) 100%), radial-gradient(circle at 37% 71%, #fff, 0.5vmin, #fff0 calc(0.5vmin + 1px) 100%), radial-gradient(circle at 40% 60%, var(--c2), 1.65vmin, #fff0 calc(1.65vmin + 1px) 100%) var(--c1); } .row:nth-child(2) { --znt: 1.3,1.3,1.3; margin-top: 0vmin; animation: orbit-nucleous3 3s linear 0s infinite; } @keyframes orbit-nucleous { 0% { transform: rotateX(80deg) rotate(0deg); } 100% { transform: rotateX(80deg) rotate(360deg);} } @keyframes orbit-nucleous3 { 0% { transform: rotateX(80deg) rotate(0deg) scale3d(var(--znt)); } 100% { transform: rotateX(80deg) rotate(360deg) scale3d(var(--znt)); } } .row div { --c1: #bc0003; --c2: #fa0001; width: 6vmin; height: 6vmin; border: 1px solid #0006; border-radius: 100%; background: radial-gradient(circle at 40% 60%, #fff0, 3vmin, #00000040 calc(3vmin + 1px) 100%), radial-gradient(circle at 28% 57%, #fff, 0.3vmin, #fff0 calc(0.3vmin + 1px) 100%), radial-gradient(circle at 37% 71%, #fff, 0.5vmin, #fff0 calc(0.5vmin + 1px) 100%), radial-gradient(circle at 40% 60%, var(--c2), 1.65vmin, #fff0 calc(1.65vmin + 1px) 100%) var(--c1); position: absolute; top: -3vmin; animation: orbit-nucleous-particle 3s linear 0s infinite; } @keyframes orbit-nucleous-particle { 0% { transform: rotateX(90deg) rotateY(360deg) scale3d(0.75, 0.75, 0.75); } 100% { transform: rotateX(90deg) rotateY(0deg) scale3d(0.75, 0.75, 0.75);} } .row div.neutron { --c1: #082976; --c2: #124b9c; } .row div:nth-child(2) { top: calc(100% - 3vmin); } .row div:nth-child(3) { left: -3vmin; top: calc(50% - 3vmin); } .row div:nth-child(4) { left: calc(100% - 3vmin); top: calc(50% - 3vmin); } /*** ELECTRONS ***/ .orbits { position: absolute; width: 100%; height: 100%; border-radius: 100%; animation: orbit-spin 180s linear 0s infinite; } @keyframes orbit-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg);} } .orbits:before, .orbits:after { content: ""; position: absolute; width: 100%; height: 100%; border-radius: 100%; animation: orbit-spin 180s linear 0s infinite; border: 0.2vmin dotted #CDDC3980; filter: blur(1px); opacity: 0.5; } .orbits:after { width: 60%; height: 60%; top: 20%; left: 20%; animation-direction: reverse; animation-duration: 90s; } .electron { --pos: rotateY(0deg); --tim: 2s; position: absolute; width: 100%; height: 100%; box-shadow: -10px 5px 3px -5px #CDDC3920 inset, 10px 0px 3px -5px #CDDC3920; border-radius: 100%; transition: all 0.4s ease 0s; transform: rotateX(80deg) rotate(180deg); animation: orbit-electron var(--tim) linear calc(var(--tim) * -0.5) infinite; } @keyframes orbit-electron { 0% { transform: rotateX(80deg) var(--pos) rotate(0deg); } 100% { transform: rotateX(80deg) var(--pos) rotate(-360deg);} } .electron:before { --c1: #8BC34A; --c2: #CDDC39; width: 1vmin; height: 1vmin; content: ""; position: absolute; border-radius: 100%; box-shadow: 0 0 9px 0px #CDDC39; border: 1px solid #fff8; left: calc(50% - 0.5vmin); top: -0.5vmin; background: radial-gradient(circle at 40% 60%, #fff0, 3vmin, #00000040 calc(3vmin + 1px) 100%), radial-gradient(circle at 45% 73%, #fff, 0.3vmin, #fff0 calc(0.3vmin + 1px) 100%), radial-gradient(circle at 27% 58%, #fff, 0.5vmin, #fff0 calc(0.5vmin + 1px) 100%), radial-gradient(circle at 40% 60%, var(--c2), 1vmin, #fff0 calc(1vmin + 1px) 100%), var(--c1); transform: rotateX(90deg); animation: orbit-electron-particle var(--tim) linear 0s infinite; } @keyframes orbit-electron-particle { 0% { transform: rotateX(90deg) rotateY(-360deg); } 100% { transform: rotateX(90deg) rotateY(0deg);} } .electron:nth-child(2) { --pos: rotateY(70deg); --tim: 1.535s; } .electron:nth-child(3) { --pos: rotateY(40deg); --tim: 1.875s; } .electron:nth-child(4) { --pos: rotateY(110deg); --tim: 1.275s; } .electron:nth-child(n+5) { width: 67%; height: 67%; left: 18%; top: 18%; } .electron:nth-child(5) { --pos: rotateY(140deg); --tim: 1.125s; } .electron:nth-child(6) { --pos: rotateY(25deg); --tim: 1s; } /*** INFO ***/ .info { position: absolute; width: 98vw; height: 60vmin; z-index: -1; font-family: Arial, serif; display: flex; align-items: center; justify-content: center; } .inner-shell, .outer-shell, .inner-nucleous { width: 20.5vmin; height: 12vmin; position: absolute; display: flex; align-items: center; justify-content: flex-end; opacity: 0.05; top: 40vmin; color: #fff;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0