Skip to main content
ExodeUI

EXODEUI DESKTOP

A little space for good ideas.

Choose your platform to get the official ExodeUI installer.

Looking for Intel Mac or other builds? Explore the web studio or check all download options.

Prefer the browser? Try for free in your browser →
Framer Motion集群8 分鐘閱讀·ExodeUI 團隊

掌握 Framer Motion 和 ExodeUI 中的彈簧物理

Framer Motion 中彈簧物理的完整指南。掌握剛度、阻尼、品質和restDelta,並使用 ExodeUI 探索視覺創作。

直接總結與定義

核心要點

Framer Motion 中的彈簧物理特性以物理模擬取代了基於時間的緩動曲線。彈簧受剛度(張力)、阻尼(摩擦)和質量的控制,根據距離和輸入速度自動計算持續時間,確保互動不會感到突然或遲緩。

Framer Motion彈簧的三個參數

在 Framer Motion 中,transition: { type: "spring" } 採用三個主要物理參數:

  • 剛度:較高的值(例如 500)會快速捕捉到目標;較低的值(例如 150)會緩慢滑動。
  • 阻尼:控制回彈。阻尼低於 20 會導致明顯的彈跳; 28 左右的阻尼營造出乾淨、專業的安定感。
  • 質量:乘以動量和減速距離。預設值為 1.0。

生產實施片段

互動組件實現
// Framer Motion Spring Transition
import { motion } from 'framer-motion';

export const SnappyModal = () => (
  <motion.div
    initial={{ scale: 0.8, opacity: 0 }}
    animate={{ scale: 1, opacity: 1 }}
    transition={{
      type: 'spring',
      stiffness: 420,
      damping: 26,
      mass: 0.9
    }}
    className="modal-box p-8 rounded-2xl bg-zinc-900 text-white"
  >
    Physics-Driven Modal
  </motion.div>
);

相關指南和範例

互動式 UI 只需設計一次,交付同一個檔案。

在 ExodeUI 中以視覺方式建立狀態、彈簧物理與邏輯,並在 React、SwiftUI、Flutter 等中播放同一個檔案。免費開始。

免費試用