blur模糊
结合模糊、透明度与遮罩柔和地揭示媒体或内容层。
预览
用于柔化元素或掩盖细小瑕疵的模糊滤镜。
标准减弱
标准减弱
预览
实现「模糊」:结合模糊、透明度与遮罩柔和地揭示媒体或内容层。 参数设为时长 260ms、模糊半径 14px、揭示方式 blur、曲线 soft。在状态发生变化时触发一次,并允许重新播放。使用语义化 HTML,CSS 作用域限定在 .motion-demo--blur。为 prefers-reduced-motion 和 .force-reduced-motion 提供等价的低动态方案。
<div class="motion-demo motion-demo--blur" data-motion="blur" aria-label="模糊 示例">
<article class="motion-surface">
<strong>模糊</strong>
<span class="motion-line"></span>
<span class="motion-line"></span>
</article>
</div>.motion-demo.motion-demo--blur {
box-sizing: border-box;
position: relative;
display: grid;
place-items: center;
width: min(100%, 34rem);
min-height: 15rem;
padding: 2rem;
overflow: hidden;
color: #18181b;
background: #fafafa;
border: 1px solid #e4e4e7;
border-radius: 16px;
isolation: isolate;
}
.motion-demo.motion-demo--blur *, .motion-demo.motion-demo--blur *::before, .motion-demo.motion-demo--blur *::after {
box-sizing: border-box;
}
.motion-demo.motion-demo--blur .motion-surface {
position: relative;
display: grid;
gap: 0.65rem;
width: min(100%, 18rem);
padding: 1.25rem;
background: #ffffff;
border: 1px solid #e4e4e7;
border-radius: 16px;
box-shadow: none;
}
.motion-demo.motion-demo--blur .motion-surface strong { font-weight: 500; }
.motion-demo.motion-demo--blur .motion-line {
display: block;
width: 100%;
height: 0.5rem;
background: #e4e4e7;
border-radius: 999px;
}
.motion-demo.motion-demo--blur .motion-line:last-child { width: 62%; }
.motion-demo.motion-demo--blur .motion-button {
position: relative;
min-height: 2.75rem;
padding: 0.75rem 1.1rem;
color: white;
font: inherit;
font-weight: 700;
background: #18181b;
border: 0;
border-radius: 999px;
cursor: pointer;
}
.motion-demo.motion-demo--blur .motion-button:focus-visible { outline: 3px solid rgb(37 99 235 / 32%); outline-offset: 3px; }
.motion-demo.motion-demo--blur .motion-action-row {
display: flex;
justify-content: center;
gap: 0.5rem;
margin-top: 0.85rem;
}
.motion-demo.motion-demo--blur .motion-replay-scene {
width: min(100%, 22rem);
display: grid;
place-items: center;
}
.motion-demo.motion-demo--blur .motion-pausable-scene {
width: min(100%, 22rem);
display: grid;
place-items: center;
}
.motion-demo.motion-demo--blur button.motion-surface {
color: inherit;
font: inherit;
text-align: start;
cursor: pointer;
}
.motion-demo.motion-demo--blur .motion-replay-button,
.motion-demo.motion-demo--blur .motion-undo-button,
.motion-demo.motion-demo--blur .motion-dismiss-button,
.motion-demo.motion-demo--blur .motion-pause-button {
min-height: 2.75rem;
padding: 0.65rem 0.9rem;
color: #18181b;
font: 650 0.78rem/1 ui-sans-serif, system-ui, sans-serif;
background: #ffffff;
border: 1px solid #d4d4d8;
border-radius: 8px;
cursor: pointer;
}
.motion-demo.motion-demo--blur .motion-replay-button:focus-visible,
.motion-demo.motion-demo--blur .motion-undo-button:focus-visible,
.motion-demo.motion-demo--blur .motion-dismiss-button:focus-visible,
.motion-demo.motion-demo--blur .motion-pause-button:focus-visible,
.motion-demo.motion-demo--blur [data-reorder-item]:focus-visible,
.motion-demo.motion-demo--blur [data-swipe-target]:focus-visible {
outline: 3px solid rgb(37 99 235 / 32%);
outline-offset: 3px;
}
.motion-demo.motion-demo--blur .motion-status {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.motion-demo.motion-demo--blur .motion-ripple-ink {
position: absolute;
width: 12px;
height: 12px;
pointer-events: none;
background: rgb(255 255 255 / 72%);
border-radius: 50%;
transform: translate(-50%, -50%) scale(0.95);
opacity: 0;
}
.motion-demo.motion-demo--blur .motion-state-stack { position: relative; width: min(100%, 18rem); height: 9rem; }
.motion-demo.motion-demo--blur .motion-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; background: #ffffff; border: 1px solid #e4e4e7; border-radius: 16px; }
.motion-demo.motion-demo--blur .motion-state--to { background: #18181b; color: white; }
.motion-demo.motion-demo--blur .motion-scroll-track > span { color: #71717a; font: 600 0.72rem/1.2 ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.motion-demo.motion-demo--blur .motion-orbit-item { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; color: white; background: #2563eb; border-radius: 50%; }
.motion-demo.motion-demo--blur .motion-text-stack { position: relative; width: min(100%, 18rem); min-height: 4rem; }
.motion-demo.motion-demo--blur svg { width: min(100%, 20rem); height: auto; }
.motion-demo.motion-demo--blur .motion-surface { animation: motion-blur 260ms cubic-bezier(0.23, 1, 0.32, 1) 0ms both; }
@keyframes motion-blur { from { opacity: 0; filter: blur(14px); transform: translateY(28px); } to { opacity: 1; filter: blur(0); clip-path: inset(0); transform: none; } }
@keyframes motion-blur-reduced-fade {
from { opacity: 0.84; }
to { opacity: 1; }
}
.force-reduced-motion .motion-demo.motion-demo--blur {
animation: motion-blur-reduced-fade 160ms cubic-bezier(0.23, 1, 0.32, 1) both !important;
}
.force-reduced-motion .motion-demo.motion-demo--blur *,
.force-reduced-motion .motion-demo.motion-demo--blur *::before,
.force-reduced-motion .motion-demo.motion-demo--blur *::after {
animation: none !important;
animation-delay: 0ms !important;
animation-iteration-count: 1 !important;
transition-property: opacity, color, background-color, border-color !important;
transition-duration: 160ms !important;
transition-delay: 0ms !important;
scroll-behavior: auto !important;
}
.force-reduced-motion .motion-demo.motion-demo--blur .motion-button,
.force-reduced-motion .motion-demo.motion-demo--blur [data-reorder-item],
.force-reduced-motion .motion-demo.motion-demo--blur [data-swipe-target],
.force-reduced-motion .motion-demo.motion-demo--blur [data-spring-target] {
transform: none !important;
}
.force-reduced-motion .motion-demo.motion-demo--blur .motion-path { stroke-dashoffset: 0 !important; }
.force-reduced-motion .motion-demo.motion-demo--blur .motion-word--from { opacity: 0 !important; visibility: hidden; }
.force-reduced-motion .motion-demo.motion-demo--blur .motion-word:not(.motion-word--from) { opacity: 1 !important; filter: none !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
.motion-demo.motion-demo--blur {
animation: motion-blur-reduced-fade 160ms cubic-bezier(0.23, 1, 0.32, 1) both !important;
}
.motion-demo.motion-demo--blur *, .motion-demo.motion-demo--blur *::before, .motion-demo.motion-demo--blur *::after {
animation: none !important;
animation-delay: 0ms !important;
animation-iteration-count: 1 !important;
transition-property: opacity, color, background-color, border-color !important;
transition-duration: 160ms !important;
transition-delay: 0ms !important;
scroll-behavior: auto !important;
}
.motion-demo.motion-demo--blur .motion-button,
.motion-demo.motion-demo--blur [data-reorder-item],
.motion-demo.motion-demo--blur [data-swipe-target],
.motion-demo.motion-demo--blur [data-spring-target] {
transform: none !important;
}
.motion-demo.motion-demo--blur .motion-path { stroke-dashoffset: 0 !important; }
.motion-demo.motion-demo--blur .motion-word--from { opacity: 0 !important; visibility: hidden; }
.motion-demo.motion-demo--blur .motion-word:not(.motion-word--from) { opacity: 1 !important; filter: none !important; transform: none !important; }
}深入了解
术语与辨析
blur模糊
Blur英文定义
A blur filter blends neighboring pixels to soften edges, depth layers, or transitional artifacts.
中文翻译
用于柔化元素或掩盖细小瑕疵的模糊滤镜。
clip-path裁切路径
Clip-path英文定义
A geometric clipping region controls which portion of an element is painted.
中文翻译
把元素裁切成指定形状,可用于揭示、遮罩和前后对比滑杆。
辨析
裁切路径使用清晰形状边界隐藏区域;模糊滤镜柔化像素,并不定义可见区域。
mask遮罩
Mask英文定义
An alpha or luminance image modulates visibility, allowing gradients and soft-edged reveals.
中文翻译
使用形状或渐变隐藏、揭示元素的部分区域;它类似裁切路径,同时支持柔和、可渐隐的边缘。
辨析
遮罩通过透明度或亮度控制可见区域并支持软边;模糊滤镜只负责柔化图像。
实现前检查
- 目的
- 用模糊柔化媒体或过渡边缘,并掩盖加载或合成中的细小瑕疵。
- 频率
- 适合低频媒体揭示和背景层;正文与高频控件避免持续滤镜。
- 触发
- 由媒体就绪、层级切换或焦点变化触发,模糊半径保持克制。
- 进入 / 离开
- 进入时模糊快速归零并同步淡入;离开仅在层级关系明确时增加模糊。
- 可打断性
- 状态改变时从当前滤镜值继续,并在完成后移除不必要的 filter。
- 手势与键盘
- 无需手势;可拖动遮罩和裁切比较归入专用交互模式。
- 减弱动效策略
- 直接显示清晰内容,仅保留静态层级和透明度变化。
可访问性
减弱动效
直接显示清晰内容,仅保留静态层级和透明度变化。
参数参考
| 参数 | 范围 / 选项 | 默认值 | 作用 |
|---|---|---|---|
duration | 80ms–1200ms | 260ms | 控制一次动效完成所需的时间。 |
blur | 0px–32px | 14px | 调节模糊半径。 |
reveal | 模糊 / 裁切 / 遮罩 | 模糊 | 选择揭示方式。 |
ease | 柔和 / 清脆 / 平稳 / 匀速 | 柔和 | 控制速度随时间变化的方式。 |
交付前检查
- 检查 filter 对大面积绘制和低端设备的成本。
- 明确区分 Blur、Clip-path 与 Mask。