算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
fitts-law【设计与创意】Use this skill whenever the question involves how easy it is to *hit* an interactive target — buttons, links, form controls, drag handles, scrollbars, mobile tap targets, anything the user must move a pointer or finger to. Trigger when sizing buttons, designing toolbars, picking a hit-area for icon buttons, designing for touch screens, debugging "use…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Fitts's Law is the foundational quantitative model of how long it takes to acquire (point to) a target with a directed movement. The classic formulation:
T = a + b · log₂(D / W + 1)
Where T is movement time, D is the distance from the starting position to the target, W is the target's width along the axis of motion, and a, b are device-and-context constants. The logarithmic relationship is the core insight: doubling the size of a target reduces movement time by a constant amount; halving the distance to a target also reduces it by a constant amount; targets at the edges of the screen are effectively infinite in one dimension because the cursor stops there.
The time to move a cursor or finger to a target is determined by two things: how far the target is from where you start, and how big the target is. Big nearby targets are fastest; small distant targets are slowest. Edges and corners of the screen are exceptional: the cursor (or finger) cannot overshoot, so they behave as effectively infinite-sized targets along that one axis.
The law has held up across input modalities (mouse, trackpad, touch, stylus, eye-tracking) for over half a century. The constants change; the relationship doesn't.
Every clickable element imposes a Fitts's Law cost — a small one for big nearby buttons, a large one for tiny distant ones. On a single screen the cost is barely perceptible. Multiplied across a workflow with many clicks, the costs compound.
Worse, small targets aren't just slower; they're less reliable. The user may overshoot, undershoot, or miss entirely — leading to misclicks that cost a redo or, worse, an unintended action.
For touch interfaces, Fitts's Law is also an accessibility issue. Users with motor impairments, tremor, or one-handed use cases pay a much higher cost on small targets than typical users do.
The most common Fitts's Law decisions are about minimum target size. Standards converge on:
| Context | Minimum target size | Source / convention |
|---|---|---|
| Touch (general) | 44×44 px | Apple HIG; matches average fingertip contact |
| Touch (Material) | 48×48 dp | Google Material Design |
| Touch (WCAG 2.5.5 Level AAA) | 44×44 CSS px | WCAG Success Criterion 2.5.5 |
| Touch (WCAG 2.5.8 Level AA, 2.2) | 24×24 CSS px (with spacing) | WCAG Success Criterion 2.5.8 |
| Mouse-pointer UI | 32×32 px (button), 24×24 (icon button with hover-friendly hit area) | Common in dense desktop apps |
| Trackpad / fine pointer | 16×16 px is feasible but error-prone | Reserve for power-user tools |
The numbers are minimums; bigger is usually better when space allows.
Target size gets most of the attention, but distance matters equally. Two strategies:
After the user clicks "Add row," their cursor is wherever they clicked. The next thing they're likely to do (label the new row) should be close by. Don't make them traverse the screen.
If a user just clicked a row to select it, the contextual actions (edit, delete, share) should appear near that row — in a row-action toolbar or popover — not in a sidebar or a top toolbar 600px away. Distance kills speed.
A floating action button (FAB) is anchored — distance from any starting cursor position is roughly constant. For mobile in particular, this is a Fitts's Law win.
Because the pointer cannot move past the screen edge, edges and corners act as effectively-infinite targets along one axis. This is why Mac's menu bar lives at the top edge (cursor can fly up without overshooting) and why Windows's Start button lives at the corner (zero precision required to hit).
In web UIs:
A common modern web mistake: pages with no bleed, where every interactive element has 24px+ of margin. The screen edge advantage is forfeited.
Touch screens present a few twists Fitts's Law accounts for:
A common case where Fitts's Law gets violated.
Anti-pattern:
<button style="
width: 16px; height: 16px;
padding: 0; border: 0;
background: transparent;
">
<CloseIcon style="width: 16px; height: 16px;" />
</button>
A 16×16 hit area is hard to hit even with a mouse and impossible reliably with touch.
Right:
<button aria-label="Close" style="
width: 36px; height: 36px;
padding: 0; border: 0; border-radius: 0.375rem;
background: transparent;
display: grid; place-items: center;
">
<CloseIcon style="width: 16px; height: 16px;" />
</button>
The icon stays 16px (visual weight); the button is 36×36 (easy hit). On touch surfaces, push to 44×44.
<div style="display: flex; gap: 0.25rem;">
<button aria-label="Bold" style="width: 32px; height: 32px;"><BoldIcon /></button>
<button aria-label="Italic" style="width: 32px; height: 32px;"><ItalicIcon /></button>
<button aria-label="Underline" style="width: 32px; height: 32px;"><UnderlineIcon /></button>
</div>
Each button has a 32×32 hit area. The 4px gap is small enough to keep buttons close (low D in Fitts's formula), but large enough to prevent accidental neighbor-clicks.
<form style="display: grid; gap: 1rem;">
<input />
<input />
<input />
<button class="primary" style="
height: 44px;
padding: 0 1.5rem;
align-self: end;
">
Submit
</button>
</form>
The Submit button is 44px tall (touch-friendly), aligned to the right edge of the form (predictable position users will learn). Distance from the last input is small — the user's cursor is already nearby.
<nav style="
position: fixed; bottom: 0; left: 0; right: 0;
display: grid; grid-template-columns: repeat(5, 1fr);
height: calc(56px + env(safe-area-inset-bottom));
padding-bottom: env(safe-area-inset-bottom);
">
<button style="display: grid; gap: 2px; place-items: center;">
<HomeIcon />
<span style="font-size: 10px;">Home</span>
</button>
<!-- … 4 more items … -->
</nav>
Bottom-anchored: thumb reaches naturally and the screen edge stops travel. Each item is ~76px wide × 56px tall — generous targets. Five-item maximum to keep per-item width above ~72px.
<!-- The save button is large, central, and easy. The destructive button is
small and visually demoted. The user must aim deliberately. -->
<div style="display: flex; justify-content: space-between; align-items: center;">
<button class="text-button danger" style="font-size: 0.875rem;">
Delete account
</button>
<button class="primary" style="height: 44px; padding: 0 2rem;">
Save changes
</button>
</div>
The destructive action's small target size and visual demotion are deliberate Fitts's Law penalties. They're features.
affordance — Fitts's Law sets the size a target needs; affordance sets whether the user knows it's a target at all.defensible-space — separating destructive controls from common ones is an intentional Fitts's Law penalty for safety.mapping — placing controls near the things they affect reduces Fitts's distance.visibility — a target you can't see has effectively infinite distance.accessibility (process) — Fitts's Law is fundamentally about motor accessibility; bigger and edge-aligned targets help everyone.fitts-law-touch-targets — applying the law to touchscreen interfaces specifically.fitts-law-screen-edges — exploiting (and respecting) the screen-edge advantage.fitts-law-pointer-acceleration — how cursor speed and acceleration interact with target size, especially on trackpad and mouse.