Entrance motionMotion
Three entrance motions for overlays, one for each kind of overlay. Tap “Replay” to watch them again.
Demo
展卷
定
浮起
卷帘
点灯
Unroll
Settle
Rise
Blind
Lighting
<div class="hao-row" style="gap:var(--hao-space-5);align-items:flex-start">
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">展卷</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div class="hao-scrim hao-scrim--bottom hao-scrim--enter" id="ms1" style="position:absolute;inset:0">
<div class="hao-sheet hao-sheet--enter" id="mh1">
<div class="hao-sheet__grabber" aria-hidden="true"></div>
<h2 class="hao-sheet__title">晨间札记</h2>
<ul class="hao-list">
<li>
<a class="hao-list__row" href="#">
<span class="hao-list__title">分享</span>
<i class="hao-icon hao-icon--chevron-right hao-list__chev" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="hao-list__row" href="#">
<span class="hao-list__title">移到文件夹</span>
<i class="hao-icon hao-icon--chevron-right hao-list__chev" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="ms1:hao-scrim--enter,mh1:hao-sheet--enter">
重播
</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">定</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div class="hao-scrim hao-scrim--enter" id="md1" style="position:absolute;inset:0;padding:var(--hao-space-4)">
<div class="hao-dialog hao-dialog--enter" id="mg1">
<h2 class="hao-dialog__title">删除这条札记</h2>
<p class="hao-dialog__body">删除后无法恢复。</p>
<div class="hao-dialog__actions">
<button class="hao-btn hao-btn--tinted" style="min-width:0">取消</button>
<button class="hao-btn hao-btn--seal" style="min-width:0">删除</button>
</div>
</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="md1:hao-scrim--enter,mg1:hao-dialog--enter">
重播
</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">浮起</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div style="position:absolute;left:0;right:0;bottom:var(--hao-space-5);display:flex;justify-content:center">
<div class="hao-toast hao-toast--enter" id="mt1" role="status">已保存</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="mt1:hao-toast--enter">重播</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">卷帘</p>
<div style="position:relative;box-sizing:border-box;width:280px;height:300px;padding:var(--hao-space-4);border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<span class="hao-btn hao-btn--sm hao-btn--tinted" aria-hidden="true">更多操作</span>
<ul class="hao-menu hao-menu--enter" id="mm1" role="menu" style="margin-top:var(--hao-space-2);width:220px">
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">分享</button></li>
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">移到文件夹</button></li>
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">复制一份</button></li>
</ul>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="mm1:hao-menu--enter">重播</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">点灯</p>
<div style="position:relative;box-sizing:border-box;width:280px;height:300px;padding:var(--hao-space-4);border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div class="hao-card" style="margin-top:var(--hao-space-2)">
<span class="hao-lamp hao-lamp--lit" id="ml1" aria-pressed="true" role="img" aria-label="已收藏"></span>
<h3 class="hao-card__title" style="padding-right:var(--hao-space-8)">晨间札记</h3>
<p class="hao-card__body">窗外起了薄雾。</p>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="ml1:hao-lamp--lit">重播</button>
</div>
</div><div class="hao-row" style="gap:var(--hao-space-5);align-items:flex-start">
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">Unroll</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div class="hao-scrim hao-scrim--bottom hao-scrim--enter" id="ms2" style="position:absolute;inset:0">
<div class="hao-sheet hao-sheet--enter" id="mh2">
<div class="hao-sheet__grabber" aria-hidden="true"></div>
<h2 class="hao-sheet__title">Morning note</h2>
<ul class="hao-list">
<li>
<a class="hao-list__row" href="#">
<span class="hao-list__title">Share</span>
<i class="hao-icon hao-icon--chevron-right hao-list__chev" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="hao-list__row" href="#">
<span class="hao-list__title">Move to folder</span>
<i class="hao-icon hao-icon--chevron-right hao-list__chev" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="ms2:hao-scrim--enter,mh2:hao-sheet--enter">
Replay
</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">Settle</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div class="hao-scrim hao-scrim--enter" id="md2" style="position:absolute;inset:0;padding:var(--hao-space-4)">
<div class="hao-dialog hao-dialog--enter" id="mg2">
<h2 class="hao-dialog__title">Delete this note</h2>
<p class="hao-dialog__body">This can’t be undone.</p>
<div class="hao-dialog__actions">
<button class="hao-btn hao-btn--tinted" style="min-width:0">Cancel</button>
<button class="hao-btn hao-btn--seal" style="min-width:0">Delete</button>
</div>
</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="md2:hao-scrim--enter,mg2:hao-dialog--enter">
Replay
</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">Rise</p>
<div style="position:relative;width:280px;height:300px;border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div style="position:absolute;inset:0;padding:var(--hao-space-4);display:flex;flex-direction:column;gap:var(--hao-space-3)" aria-hidden="true">
<div style="height:32px;width:100px;border-radius:var(--hao-radius-sm);background:var(--hao-surface-sunken)"></div>
<div style="flex:1;border-radius:var(--hao-radius-lg);background:var(--hao-surface)"></div>
</div>
<div style="position:absolute;left:0;right:0;bottom:var(--hao-space-5);display:flex;justify-content:center">
<div class="hao-toast hao-toast--enter" id="mt2" role="status">Saved</div>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="mt2:hao-toast--enter">Replay</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">Blind</p>
<div style="position:relative;box-sizing:border-box;width:280px;height:300px;padding:var(--hao-space-4);border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<span class="hao-btn hao-btn--sm hao-btn--tinted" aria-hidden="true">More actions</span>
<ul class="hao-menu hao-menu--enter" id="mm2" role="menu" style="margin-top:var(--hao-space-2);width:220px">
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">Share</button></li>
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">Move to folder</button></li>
<li role="none"><button class="hao-menu__item" role="menuitem" tabindex="-1">Duplicate</button></li>
</ul>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="mm2:hao-menu--enter">Replay</button>
</div>
<div>
<p style="margin:0 0 var(--hao-space-2);font:400 13px/20px var(--hao-font-sans);color:var(--hao-ink-tertiary)">Lighting</p>
<div style="position:relative;box-sizing:border-box;width:280px;height:300px;padding:var(--hao-space-4);border-radius:var(--hao-radius-xl);background:var(--hao-bg);overflow:hidden;border:1px solid var(--hao-hairline)">
<div class="hao-card" style="margin-top:var(--hao-space-2)">
<span class="hao-lamp hao-lamp--lit" id="ml2" aria-pressed="true" role="img" aria-label="Saved"></span>
<h3 class="hao-card__title" style="padding-right:var(--hao-space-8)">Morning note</h3>
<p class="hao-card__body">Fog outside the window.</p>
</div>
</div>
<button class="hao-btn hao-btn--sm hao-btn--tinted" style="margin-top:var(--hao-space-3)" data-replay="ml2:hao-lamp--lit">Replay</button>
</div>
</div>Usage
| Class | Name | Look | For |
|---|---|---|---|
hao-sheet--enter | Unrolling | Spreads upward from the bottom edge, like a scroll opening from below; the content inside fades in a moment later | Sheets |
hao-dialog--enter | Settling | Fades in place, scaling up from 96% to full | Dialogs |
hao-menu--enter | Blind | Like a bamboo blind let down: it opens from the edge that touches the button, and the items fade in a moment later. When the menu flips above its button, add hao-menu--up and it rolls upward | Menus |
hao-lamp--lit | Lighting | The lamp body lights and the whole lamp sways twice before it rests | The bookmark, at the moment of saving |
hao-toast--enter | Rising | Floats up from 12px below and fades in | Toasts, bubble tips |
hao-scrim--enter | Fade in | The scrim fades in | The scrim behind sheets and dialogs |
- Unrolling is this system’s own entrance: a sheet doesn’t slide up as one block; it spreads upward where it is. It runs 320ms, fast at the start and easing to a stop.
- The entrance adds these classes to the overlay; the exit plays in reverse, at two-thirds of the duration.
- Only one overlay moves at a time. The scrim and the overlay start together.
- The stamp is another motion, reserved for the moment of completion; see
Stamp. - When Reduce Motion is on, all entrances are dropped and overlays simply appear.
- Don’t add entrance motion to ordinary page content: cards, lists, and headings are just there.
- Like the stamp, the lighting plays once, at the moment the person acts; a lamp already lit when the page opens stays still.
Accessibility
- The entrance motion carries no information: an overlay’s appearing and disappearing are decided by the
hiddenattribute, and with the motion off, the content still lands in place. - Reduce Motion is handled once, in the stylesheet; you don’t need to check it again in your own code.
- A toast must announce itself: in the preview it carries
role="status"; with the behavior script loaded, a real toast goes into anaria-livepolite region and doesn’t steal focus.