css+js实现跟随鼠标移动的摇摆铃健身器材动画效果代码
代码语言:html
所属分类:动画
代码描述:css+js实现跟随鼠标移动的摇摆铃健身器材动画效果代码
代码标签: css js 跟随 鼠标 移动 摇摆铃 健身 器材
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); background-size: 400% 400%; background-position: 0 50%; animation: gradient 15s ease infinite; cursor: grab; } @keyframes gradient { 50% { background-position: 100% 50%; } } #shake_weight { width: clamp(300px, 50%, 600px); aspect-ratio: 4 / 1; position: relative; perspective: 600px; } #shake_weight * { transition: .05s; user-select: none; } .end { width: 20%; height: 130%; position: absolute; left: -12.5%; top: -15%; border-radius: 20%; } .end.right { left: 92%; transform: scaleX(-1); } .end:before { content:''; width: 110%; height: 150%; background: linear-gradient(to bottom, rgba(0,0,0,.15) 0% 5%, transparent 15% 45%, rgba(0,0,0,.15) 55% 85%, transparent 95%), silver; position: absolute; left: -100%; top: -25%; border-radius: 35% 0 0 35%; z-index: -1; } .end:after { content:''; width: 50%; height: 150%; background: radial-gradient(at 60% 50%, #000 55%, transparent 60%), lightgray; position: absolute; left: -15%; top: -25%; border-radius: 50%; transform: rotateY(-10deg); z-index: -1; } .spring { width: 20%; height: 130%; background: radial-gradient(20% 100% at 15% 50%, black 50%, transparent 52%), radial-gradient(25% 100% at 32.5% 50%, black 50%, transparent 52%), radial-gradient(20% 100% at 50% 50%, black 50%, transparent 52%), radial-gradient(25% 100% at 68.5% 50%, black 50%, transparent 52%), radial-gradient(20% 100% at 85% 50%, black 50%, transparent 52%); position: absolute; top: -15%; border-radius: 20%; } .spring_width_left { left: -12.5%; transform-origin: 100% 50%; } .spring_width_right { left: 92%; transform-origin: 0% 50%; } .shaft { width: 100%; height: 100%; background: radial-gradient(50% 20% at 50% 50%, lightgray, transparent), radial-gradient(50% 30% at 50% 60%, white, transparent), radial-gradient(50% 30% at 50% 40%, gray, transparent), .........完整代码请登录后点击上方下载按钮下载查看
网友评论0