index.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>Xaf Pet</title>
  6. <link rel="stylesheet" href="animations.css" />
  7. <style>
  8. html, body {
  9. width: 100%; height: 100%; margin: 0; overflow: hidden;
  10. background: transparent !important;
  11. -webkit-app-region: no-drag;
  12. }
  13. #pet-stage {
  14. position: fixed; inset: 0; display: flex; align-items: flex-end;
  15. justify-content: center; pointer-events: none;
  16. background: transparent !important;
  17. }
  18. #pet {
  19. position: relative; width: 120px; height: 140px; pointer-events: auto;
  20. cursor: pointer; user-select: none;
  21. -webkit-app-region: no-drag;
  22. }
  23. #pet-body {
  24. position: relative; width: 100%; height: 100%;
  25. transform-origin: 50% 100%;
  26. cursor: pointer; --face: 1;
  27. }
  28. #pet img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
  29. /* 胸部热区:悬停 5s → 站手跟随(纯 hover,无需按键) */
  30. #chest {
  31. position: absolute; left: 50%; top: 16%; width: 55%; height: 42%;
  32. transform: translateX(-50%);
  33. pointer-events: auto; cursor: pointer; background: transparent;
  34. }
  35. #bubble {
  36. position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%);
  37. background: rgba(255,255,255,0.95); border: 2px solid #4A9BD7;
  38. border-radius: 12px; padding: 6px 12px;
  39. font: 13px/1.4 'PingFang SC', sans-serif; color: #333;
  40. white-space: nowrap; display: none; box-shadow: 0 2px 8px rgba(0,0,0,.12);
  41. pointer-events: none;
  42. }
  43. #bubble::after {
  44. content: ''; position: absolute; top: 100%; left: 50%;
  45. transform: translateX(-50%);
  46. border: 6px solid transparent; border-top-color: #4A9BD7;
  47. }
  48. /* 右键菜单 */
  49. #context-menu {
  50. position: absolute; display: none;
  51. background: #fff; border: 1px solid #ccc; border-radius: 6px;
  52. box-shadow: 0 2px 12px rgba(0,0,0,.15); padding: 4px 0;
  53. min-width: 120px; z-index: 9999; pointer-events: auto;
  54. }
  55. #context-menu .item {
  56. padding: 6px 16px; font-size: 13px; cursor: pointer; color: #333;
  57. }
  58. #context-menu .item:hover { background: #f0f6ff; }
  59. #context-menu .divider { height: 1px; background: #e0e0e0; margin: 4px 0; }
  60. </style>
  61. </head>
  62. <body>
  63. <div id="pet-stage">
  64. <div id="pet">
  65. <div id="pet-body">
  66. <img id="pet-img" src="" alt="pet" draggable="false" />
  67. </div>
  68. <div id="chest"></div>
  69. <div id="bubble"></div>
  70. </div>
  71. </div>
  72. <!-- 右键菜单 -->
  73. <div id="context-menu">
  74. <div class="item" data-action="settings">设置</div>
  75. <div class="item" data-action="passthrough">鼠标穿透</div>
  76. <div class="divider"></div>
  77. <div class="item" data-action="quit">退出</div>
  78. </div>
  79. <script src="animation-gen.js"></script>
  80. <script src="pet-engine.js"></script>
  81. <script src="pet-pose.js"></script>
  82. <script src="bridge.js"></script>
  83. <script src="interactions.js"></script>
  84. </body>
  85. </html>