p5实现ik多关节跟随鼠标爬行的壁虎小动物代码

代码语言:html

所属分类:动画

代码描述:p5实现ik多关节跟随鼠标爬行的壁虎小动物代码

代码标签: p5 ik 多关节 跟随 鼠标 爬行 壁虎 动物 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>🦎 可爱壁虎爬行模拟 - IK多关节系统</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script>
    <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 0%, #16213e 50%, #0f3460 100%);
            overflow: hidden;
            font-family: 'Segoe UI', Arial, sans-serif;
        }
        
        #canvas-container {
            position: relative;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        }
        
        #info-panel {
            position: fixed;
            top: 20px;
            left: 20px;
            background: rgba(20, 30, 50, 0.9);
            padding: 20px;
            border-radius: 15px;
            color: #a0c4ff;
            font-size: 14px;
            border: 1px solid rgba(100, 150, 255, 0.3);
            max-width: 280px;
        }
        
        #info-panel h2 {
            color: #00d4ff;
            margin-bottom: 15px;
            font-size: 1.3em;
        }
        
        #info-panel p {
            margin: 8px 0;
            line-height: 1.5;
        }
        
        .highlight {
            color: #ffcc00;
        }
        
        #controls {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(20, 30, 50, 0.9);
            padding: 15px 25px;
            border-radius: 30px;
            display: flex;
            gap: 20px;
            align-items: center;
            border: 1px solid rgba(100, 150, 255, 0.3);
        }
        
        .control-btn {
            background: linear-gradient(135deg, #0066cc, #00d4ff);
            border: none;
            color: white;
            padding: 10px 20px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s;
        }
        
        .control-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 20px rgba(0, 150, 255, 0.4);
        }
        
        .control-label {
            color: #a0c4ff;
            font-size: 14px;
        }
        
        input[type="range"] {
            width: 100px;
            height: 6px;
            -webkit-appearance: none;
            background: linear-gradient(90deg, #0066cc, #00d4ff);
            border-radius: 3px;
            outline: none;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 18px;
            height: 18px;
            .........完整代码请登录后点击上方下载按钮下载查看

网友评论0