跳至主要内容

Transitions & Easing

在 ChatGPT 中打开

过渡变量用于在您的应用程序中提供一致的动画持续时间。它们控制动画完成所需的时间。

示例

.element {
transition: background-color var(--dwc-transition-slow);
}

变量

变量默认值
--dwc-transition-x-slow1000ms
--dwc-transition-slow300ms
--dwc-transition-medium250ms
--dwc-transition-fast150ms
--dwc-transition-x-fast100ms
--dwc-transitionvar(--dwc-transition-medium)

缓动

缓动变量定义了值随时间的变化方式,使过渡感觉更加自然。

示例

.element {
transition: transform var(--dwc-transition) var(--dwc-ease-inOutBack);
}

标准缓动

这些是大多数组件使用的通用缓动曲线:

变量立方贝塞尔
--dwc-easecubic-bezier(0.4, 0, 0.2, 1)
--dwc-ease-outcubic-bezier(0, 0, 0.2, 1)
--dwc-ease-incubic-bezier(0.4, 0, 1, 1)
--dwc-ease-outGlidecubic-bezier(0.32, 0.72, 0, 1)

扩展缓动

变量立方贝塞尔测试链接
--dwc-ease-inQuadcubic-bezier(0.55, 0.085, 0.68, 0.53)测试它
--dwc-ease-outQuadcubic-bezier(0.25, 0.46, 0.45, 0.94)测试它
--dwc-ease-inOutQuadcubic-bezier(0.455, 0.03, 0.515, 0.955)测试它
--dwc-ease-inCubiccubic-bezier(0.55, 0.055, 0.675, 0.19)测试它
--dwc-ease-outCubiccubic-bezier(0.215, 0.61, 0.355, 1)测试它
--dwc-ease-inOutCubiccubic-bezier(0.645, 0.045, 0.355, 1)测试它
--dwc-ease-inQuartcubic-bezier(0.895, 0.03, 0.685, 0.22)测试它
--dwc-ease-outQuartcubic-bezier(0.165, 0.84, 0.44, 1)测试它
--dwc-ease-inOutQuartcubic-bezier(0.77, 0, 0.175, 1)测试它
--dwc-ease-inQuintcubic-bezier(0.755, 0.05, 0.855, 0.06)测试它
--dwc-ease-outQuintcubic-bezier(0.23, 1, 0.32, 1)测试它
--dwc-ease-inOutQuintcubic-bezier(0.86, 0, 0.07, 1)测试它
--dwc-ease-inExpocubic-bezier(0.95, 0.05, 0.795, 0.035)测试它
--dwc-ease-outExpocubic-bezier(0.19, 1, 0.22, 1)测试它
--dwc-ease-inOutExpocubic-bezier(1, 0, 0, 1)测试它
--dwc-ease-inCirccubic-bezier(0.6, 0.04, 0.98, 0.335)测试它
--dwc-ease-outCirccubic-bezier(0.075, 0.82, 0.165, 1)测试它
--dwc-ease-inOutCirccubic-bezier(0.785, 0.135, 0.15, 0.86)测试它
--dwc-ease-inBackcubic-bezier(0.36, 0, 0.66, -0.56)测试它
--dwc-ease-outBackcubic-bezier(0.34, 1.56, 0.64, 1)测试它
--dwc-ease-inOutBackcubic-bezier(0.68, -0.6, 0.32, 1.6)测试它

减少运动

webforJ 尊重用户的“减少运动”无障碍偏好。当在操作系统级别启用时,webforJ 会自动禁用所有组件中的非必要动画。无需Java代码。

操作系统级别的减少运动设置

用户启用该偏好的位置:

  • Windows 10/11: 设置 > 无障碍 > 显示 > 在 Windows 中显示动画
  • macOS: 系统设置 > 辅助功能 > 显示 > 减少运动
  • iOS: 设置 > 辅助功能 > 动作 > 减少运动
  • Android: 设置 > 辅助功能 > 移除动画