tailwind+matter布局实现5种重力模拟效果代码

代码语言:html

所属分类:动画

代码描述:tailwind+matter布局实现5种重力模拟效果代码,支持参数调整。

代码标签: tailwind matter 布局 重力 模拟

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

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/tailwindcss.3.4.16.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/matter.0.19.0.js"></script>
</head>
<body class="bg-gray-900 min-h-screen flex items-center justify-center p-4">
  <div class="max-w-6xl w-full">
    <div class="grid grid-cols-2 gap-6">
      <!-- Controls Panel -->
      <div class="bg-gray-800 border border-gray-700 rounded-lg p-4 space-y-3">
        <h2 class="text-lg font-semibold text-white mb-3">Physics Controls</h2>
        
        <!-- Custom Example Dropdown -->
        <div class="relative">
          <button id="dropdownBtn" class="w-full bg-gray-700 border border-gray-600 text-white rounded px-3 py-2 text-sm flex items-center justify-between hover:bg-gray-600">
            <span id="selectedExample">Basic Falling Shapes</span>
            <svg class="w-4 h-4 transform transition-transform" id="dropdownArrow" fill="currentColor" viewBox="0 0 20 20">
              <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"/>
            </svg>
          </button>
          <div id="dropdownMenu" class="absolute top-full left-0 w-full bg-gray-700 border border-gray-600 rounded mt-1 z-10 hidden">
            <div class="dropdown-item px-3 py-2 text-sm text-white hover:bg-gray-600 cursor-pointer border-b border-gray-600" data-value="basic">Basic Falling Shapes</div>
            <div class="dropdown-item px-3 py-2 text-sm text-white hover:bg-gray-600 cursor-pointer border-b border-gray-600" data-value="pendulum">Pendulum Chain</div>
            <div class="dropdown-item px-3 py-2 text-sm text-white hover:bg-gray-600 cursor-pointer border-b border-gray-600" data-value="pyramid">Shape Pyramid</div>
            <div class="dropdown-item px-3 py-2 text-sm text-white hover:bg-gray-600 cursor-pointer border-b border-gray-600" data-value="seesaw">Seesaw Physics</div>
            <div class="dropdown-item px-3 py-2 text-sm text-white hover:bg-gray-600 cursor-pointer" data-value="ragdoll">Ragdoll Character</div>
          </div>
        </div>
        
        <!-- Physics Controls Grid -->
        <div class="grid grid-cols-2 gap-4">
          <!-- Gravity -->
          <div>
            <div class="flex justify-between text-sm mb-2">
              <label clas.........完整代码请登录后点击上方下载按钮下载查看

网友评论0