div+css实现原子核运动动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现原子核运动动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --bg: #FBF7F4; --clr: #AEE1CD; } div { box-sizing: border-box; transform-style: preserve-3d; } body { display: grid; place-content: center; margin: 0; min-height: 100vh; background-color: var(--bg); } .nucl { position: relative; width: 10vmin; height: 10vmin; background: radial-gradient(circle, #3cf 50%, #0000 0) 50% 50%/60% 60% space, radial-gradient(circle, #3fc 50%, #0000 0) 50% 15%/60% 40% space, radial-gradient(circle, #f9c 50%, #0000 0) 50% 50%/50% 90% space, radial-gradient(circle, #3cf 50%, #0000 0) 0 0/45% 45% space; animation: turn 60s linear infinite forwards; } .nucl .ele { width: 50vmin; height: 20vmin; border-radius: 100%; border: 1px dashed color-mix(in lab, var(--clr), #0000 50%); position: absolute; translate: -20vmin -5vmin; rotate: calc(var(--r) * 180deg / var(--t)); z-index: 1; } .nucl .ele .dot { border: 1vmin solid var(--bg); background-color: var(--clr); width: 4vmin; aspect-ratio: 1; position: absolute; border-radius: 100%; offset-path: border-box; offset-distance: 0%; animation: rot linear 4s infinite forwards calc(var(--r) * -1s); z-index: 5; } .nucl:hover .ele { border-color: color-mix(in lab, var(--clr), #0005 .........完整代码请登录后点击上方下载按钮下载查看
网友评论0