{"data":{"slug":"discovered-62e1ac72517fda9884985283a5c773398f4dd0b9633917ee","title":"Nj Ui Motion Laws","summary":"Apply 26 laws of UI motion and UX to improve animations, micro-interactions, and feedback in interfaces. Use motion_lint.py to enforce rules and ensure compliance with principles like squash and stretch, anticipation, and easing.","url":"https:\/\/skillshunter.net\/skills\/discovered-62e1ac72517fda9884985283a5c773398f4dd0b9633917ee","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-62e1ac72517fda9884985283a5c773398f4dd0b9633917ee","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-62e1ac72517fda9884985283a5c773398f4dd0b9633917ee.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-62e1ac72517fda9884985283a5c773398f4dd0b9633917ee\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before using motion_lint.py, ensure that your project includes CSS, SCSS, or other supported file types. The lint tool does not analyze JavaScript-computed values, so manual checks are required for those cases. The first deliverable is a lint report in text format, which indicates PASS or FAIL based on the motion rules.","instructions":"---\nname: nj-ui-motion-laws\ndescription: The 26 laws of UI motion and UX (Disney's animation principles applied to interfaces, plus Fitts, Hick, Miller, Doherty, Postel, Jakob, Von Restorff, peak-end, origin awareness, staggering, rubber banding, interruptible motion and frequency of use) as build rules with numbers, a before\/after for each, and motion_lint.py that fails slow, linear or unguarded CSS motion. Use when building or reviewing UI animation, micro-interactions, hover\/press feedback, loading states, hit areas, menus or forms; \"make it feel better\", \"polish the motion\", \"why does this feel slow\", \u062d\u0631\u0643\u0629 \u0627\u0644\u0648\u0627\u062c\u0647\u0629, \u062a\u062d\u0633\u064a\u0646 \u0627\u0644\u062a\u0641\u0627\u0639\u0644.\n---\n\n# UI motion laws\n\nTwenty-six laws, each one a rule you can apply and check. Source: Charles Liu's reel\n\"20 Principles of UX & Animation\" (Instagram, 2026-11-12), read frame by frame;\nL21 to L26 from a second reel's 19-term list (Instagram, 2026-11-23),\nand the works it credits (NOTICE.md). For film or character animation use\n`nj-animation-direction`; for spring physics and gestures, `nj-apple-motion`.\n\n## How to use\n\n1. **Build or review** against the table below. Name the law in the code review\n   comment (for example, \"L9 snappy timing: 450ms on a toggle\").\n2. **Gate:** `python scripts\/motion_lint.py <files or folders>`. It prints one\n   line per finding, then PASS or FAIL. Fix and run again; it is the only check.\n3. **What the lint cannot see** (staging, arcs, appeal, Hick, Miller, Jakob, origin, stagger, interruptible, peak-end,\n   Doherty under real load) is a review item: walk the \"check\" column by hand\n   for the screens you touched and say which laws you checked.\n\n## The 26 laws\n\n| # | Law | Rule | Before \u2192 after (the reel's demo) | Check |\n|---|---|---|---|---|\n| L1 | Squash and stretch | Things squish on impact and stretch in motion, which gives them weight | rigid icon \u2192 icon squashes slightly on press | press scale 0.95 to 0.97, never below 0.9 |\n| L2 | Anticipation | A small pull-back before the big move | paper plane flies off \u2192 it dips back first | wind-up is 10 to 20% of the move's length |\n| L3 | Staging | Direct the eye to one thing at a time | everything animates \u2192 one element moves | at most one primary motion per moment |\n| L4 | Pose to pose | Set the key poses; let the browser fill the frames between | hand-stepped frames \u2192 start, key pose, end keyframes | keyframes, not JS per-frame updates |\n| L5 | Follow-through | Parts keep moving after the main body stops, then settle | hard stop \u2192 small overshoot and settle | overshoot only on low-frequency elements (L20) |\n| L6 | Slow in and slow out | Speed up and slow down; never move at constant speed | `linear` \u2192 ease-in-out | no `linear` except spinners and progress (lint M2) |\n| L7 | Arcs | Move along curves, not straight lines | item flies straight to cart \u2192 along an arc | add-to-cart and fly-to targets use a curved path |\n| L8 | Secondary action | A small flourish that backs up the main action | check only \u2192 check plus sparkle | the flourish is smaller and later than the main action |\n| L9 | Snappy timing | Duration sets the feel; UI animations stay under 300 ms | 600 ms toggle \u2192 200 ms | lint M1: over 300 ms fails unless marked |\n| L10 | Exaggerated feedback | Push past real so the moment lands | wrong password: nothing \u2192 field shakes | errors and successes get a visible reaction |\n| L11 | Solid drawing | Give flat things depth and volume | flat card \u2192 card with perspective | `perspective` set when you rotate in 3D |\n| L12 | Appeal | The sum of every detail, done with care | \"Downloading...\" text \u2192 a button that morphs into progress | the review lists what was polished |\n| L13 | Fitts's law | Bigger, closer targets are faster to hit | small icon far away \u2192 large and near the cursor's path | primary action is the largest target in its zone |\n| L14 | Bigger hit areas | The clickable area can be bigger than it looks | 24\u00d724 hit area \u2192 44\u00d744 | every tap target is at least 44\u00d744 CSS px (padding or `::before`) |\n| L15 | Hick's law | More choices mean slower decisions | ten equal options \u2192 few, with one default | each menu shows 7 options or fewer, or groups them |\n| L16 | Miller's law | People hold about 7 things in mind; chunk information | a 16-digit card number in one run \u2192 four groups of four | numbers longer than 6 digits display in groups |\n| L17 | Doherty threshold | Respond within 400 ms or it feels slow | 983 ms until \"Saved\" \u2192 100 ms (optimistic) | feedback within 100 ms; anything longer than 400 ms shows progress |\n| L18 | Postel's law | Accept messy input, give back clean output | rejects a phone typed with spaces \u2192 accepts it and normalises | inputs strip spaces, dashes and case before validating |\n| L19 | Jakob's law | People expect your app to work like the apps they already use | cart bottom left \u2192 cart top right | standard placements: logo top-start, cart and account top-end |\n| L20 | Frequency of use | The more often something is used, the less it should animate | command palette animates every open \u2192 instant | actions used many times a day, or from the keyboard, have no motion |\n| L21 | Origin awareness | Things grow out of where they were clicked or tapped, not from the centre | menu scales from the screen centre \u2192 from the button that opened it | popovers and menus set `transform-origin` to the trigger's side |\n| L22 | Staggering | Bring a group in one after another, not all at once | ten cards pop together \u2192 each 30 to 50 ms after the last | stagger step 30 to 50 ms; whole group still done under 300 ms + 1 step per item, cap 8 staggered items |\n| L23 | Rubber banding | Pulling past the end stretches, then springs back on release | list stops dead at the top \u2192 overscroll stretches and returns | drag past a limit moves at a fraction (about 0.3 to 0.5) of the finger, and springs back |\n| L24 | Interruptible motion | People can change their mind mid-animation | menu must finish opening before it can close \u2192 reverses at once | a second click reverses from the current state; CSS transitions or springs, not chained timeouts |\n| L25 | Von Restorff effect | The one that looks different is remembered | four identical plan cards \u2192 the recommended one stands out | one emphasised item per group, never two |\n| L26 | Peak-end rule | People remember the best moment and the ending | form submits to a blank page \u2192 a clear success state | every flow ends on a visible confirmation (L10), and its peak moment gets the care |\n\nAlways: honour `prefers-reduced-motion` (lint M4). Reduce motion to an opacity\nfade or nothing; never remove the feedback itself (L10, L17).\n\n## motion_lint.py rules\n\n| Code | Fails when | Escape hatch |\n|---|---|---|\n| M1 | a `transition` or `animation` duration is over 300 ms (L9); delays and `infinite` loops are not counted | `\/* motion-ok: <reason> *\/` on the line, for example page transitions |\n| M2 | `linear` timing on a transition or a finite animation (L6) | `infinite` animations such as spinners are allowed |\n| M3 | `transition: all` (animates layout and colour by accident) | none; name the properties |\n| M4 | the scanned files animate but none has `prefers-reduced-motion` | none |\n\nIt reads `.css .scss .less .html .vue .svelte .jsx .tsx .js .ts`. It is a text\nscan: values computed in JavaScript are not seen. `--selftest` runs its own\ncases.\n","use_cases":["Review UI animations for compliance with motion laws","Enforce animation rules using motion_lint.py","Improve micro-interactions and hover\/press feedback","Ensure accessibility by honoring `prefers-reduced-motion`","Audit loading states and hit areas for better UX"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/NJ-Burrito\/NJ-Kit\/blob\/2644ffdccb94c9eb0a65b23624abe9795e005faa\/nj-plugin\/skills\/nj-ui-motion-laws\/SKILL.md","source_commit":"2644ffdccb94c9eb0a65b23624abe9795e005faa","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:52:13.000000Z","updated_at":"2026-11-29T10:53:39.000000Z","seo_title":"UI Motion Laws and Animation Linting Tool","seo_description":"Apply 26 UI motion laws and use motion_lint.py to enforce animation rules for better UX and micro-interactions in web and app interfaces.","seo_keywords":["UI motion laws","animation linting","UX principles","micro-interactions","motion_lint.py","animation rules","prefers-reduced-motion","UI animation review"]}}