js实现canvas模拟彩色泡泡物理碰撞回弹效果代码
代码语言:html
所属分类:其他
代码描述:js实现canvas模拟彩色泡泡物理碰撞回弹效果代码
代码标签: js canvas 模拟 彩色 泡泡 物理 碰撞 回弹
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> * { margin: 0; padding: 0; box-sizing: border-box } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg,#1a1a2e,#16213e,#0f3460); font-family: 'Arial Rounded MT Bold','Arial',sans-serif; overflow: hidden } .container { position: relative; width: 100%; max-width: 1000px; text-align: center; padding: 20px; z-index: 10 } h1 { color: #e6e6ff; font-size: 2.8rem; margin-bottom: 10px; text-shadow: 0 0 10px rgba(255,255,255,0.5) } .subtitle { color: #a0a0ff; font-size: 1.2rem; margin-bottom: 30px } .canvas-container { position: relative; width: 100%; height: 500px; background: rgba(10,15,40,0.3); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); overflow: hidden; margin: 20px 0; border: 2px solid rgba(100,150,255,0.2) } canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100% } .controls { display: flex; justify-content: center; gap: 20px; margin-top: 20px; flex-wrap: wrap } .btn { background: rgba(100,150,255,0.2); color: #e6e6ff; border: 2px solid rgba(100,150,255,0.5); padding: 12px 25px; font-size: 1rem; border-radius: 50px; cursor: pointer; transition: all .3s ease; outline: 0; backdrop-filter: blur(5px) } .btn:hover { background: rgba(120,170,255,0.4); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3) } .btn:active { transform: translateY(1px) } .stats { display: flex; justify-content: center; gap: 30px; margin-top: 20px; color: #a0a0ff; font-size: 1.1rem } .info { margin-top: 30px; color: #89c; font-size: .9rem; line-height: 1.6; max-width: 700px; margin-left: auto; margin-right: auto; background: rgba(10,20,40,0.4); padding: 15px; border-radius: 15px; border: 1px solid rgba(100,150,255,0.2) } .highlight { color: #fc6; font-weight: bold } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0