YouMind
Sign in

Tutorial: Optimizing Animations for Desktop, Web, and iOS Apps

@ZacharyZhang
SIMPLIFIED CHINESEDec 02, 2026
178K
1.3K
145
48
2.4K

TL;DR

This tutorial provides a detailed AI prompt framework for optimizing UI animations across web, iOS, and desktop platforms. It defines eight continuity patterns, strict rendering parameters, and accessibility checks to eliminate disjointed transitions and enhance user experience.

First, this tutorial is based on @Kubai087's post:Use Continuity to Make Your Product Smoother – "999 Tips to Make Your Vibe Product More Polished" 015. I tested it myself and found it very useful; I've already applied it to my fully automated workflow.

This article is also published on my personal blog: https://zacharyzhang.com/blog/app-animation

Many software applications feel disjointed after features are implemented: clicking a list row causes the screen to flash as a new page appears; clicking a card makes a modal jump out from the center of the screen. The problem lies in the lack of continuity. Continuity means that when interface states change, the element clicked by the user morphs and transitions into the next state without disappearing or being rebuilt, so users always know where they came from and where they are. This approach applies to Web pages, Electron and Tauri desktop apps, and iOS, Android, and Flutter clients. Send the broken-down specifications below to an AI, and it will scan your existing codebase, identify up to 10 abrupt transition points, and wait for you to select numbers before modifying them one by one.

雷电芽衣 - inline image

GIF

I. What is Continuous Transition

Abrupt jumps in daily software concentrate in the following eight scenarios. Here is how they behave after being changed to continuous transitions:

Page Navigation

The list row title continues as the page title, and the original page title collapses into a back button. When scrolling down the page, the title moves into the top bar.

雷电芽衣 - inline image

GIF

Card Expansion

The card expands into the body text, and the card image extends into the header image; when closed via pull-down, it shrinks back along the same path to its original position.

雷电芽衣 - inline image

GIF

Mini Player Bar

The mini player bar expands into the playback page, with the cover, title, and buttons moving to their respective positions.

雷电芽衣 - inline image

GIF

Search Box

The search box moves to the top, matching items move up with input, and other items fade out.

雷电芽衣 - inline image

GIF

Data Charts

Data cards expand into charts, and small bars within the card continue as bars in the chart.

雷电芽衣 - inline image

GIF

Pop-up Menus

Menus expand from the button's original position; new items fall into the first position, and others shift back sequentially.

雷电芽衣 - inline image

GIF

Tab Switching

The selected capsule stretches first, then settles into place.

雷电芽衣 - inline image

GIF

List Reordering

When switching grid to list, sorting, or adding/deleting entries, each element moves from its old position to its new position.

雷电芽衣 - inline image

GIF

II. Breakdown of Six Rule Modules

After removing repetitive descriptions, the entire Prompt is split into six modules. For daily use, you can save modules 2 through 6 in your project's rule file and only send module 1 in each conversation; or copy the merged version in Section III and send it all at once.

1. Modification Boundaries and Execution Flow

text
1【Modification Boundaries and Execution Flow】
21. Modification Boundary: Modify within the existing codebase, tech stack, components, design variables, and layout. Preserve the original functionality, displayed content, and final positioning of each operation; only modify the transition process between states. Operated elements must morph and move into the next state; disappearing and reappearing is forbidden. Do not apply demo scenarios, add phone frames, background curtains, fake data, or extra fonts. Without asking, do not add third-party dependencies or modify routing architecture.
32. Inventory Current State: First read page, route, panel, drawer, modal, menu, and list code to determine existing animation solutions, duration curves, spring parameters, reduced motion logic, and input methods across platforms. Report results in a few sentences.
43. Diagnostic Ranking: Output a list of up to 10 modification items based on operation frequency, user disorientation level, and modification cost. Each item includes: location and trigger platform, current behavior, corresponding pattern number and continuing elements, movement path and duration curve, value rating, code modification scope, and risk. High-frequency, easily disorienting, low-cost items come first. Stop after outputting the list, ask which items I want to implement, and wait for a reply.
54. Implement One by One: For selected items, explain the implementation plan combined with the current platform, list files to be modified, wait for confirmation, then write code. Change only one item at a time. After completion, list modified files and self-check against the acceptance checklist item by item.

Directly letting AI modify site-wide animations often leads to installing unnecessary third-party libraries, inserting test fake data, or breaking routing structures. This module locks the boundaries of existing code, requiring AI to inventory the current state, submit a report of up to 10 modifications, and wait for manual selection and file confirmation before starting work.

2. Eight Types of Continuous Transition Patterns

text
1【Eight Types of Continuous Transition Patterns】
2a. Page Navigation: List row title continues as page title, row image extends as header image, previous page title collapses into back button. On page scroll, large title moves into top bar and centers in control row. Return follows the same path backward.
3b. Card Expansion: Card's own border, rounded corners, and image expand into body view or modal; title maintains same line text with font size scaling; other content fades in after card is mostly expanded. Close or pull-down shrinks back to the same card in original position.
4c. Mini Bar Expansion: Mini player bar, chat floating ball, upload/download capsule, or detail notification bar expands into full panel, with cover, title, and main button moving to new positions. Panel remains opaque; underlying page scales to 0.94 and darkens by 30%.
5d. Search and Filter: Search box moves up to top bar, original page title exits, cancel or close button slides in; during input, matching items slide from original position to result list, others fade out. Same applies to command palette on desktop.
6e. Data Summary Expansion: Data cards expand into charts, progress rings expand into reports, thumbnails expand into albums. Micro line charts become chart lines, small bars in cards continue as large bars in charts, labels move to title position, numbers scale proportionally; redrawing/replacing is forbidden.
7f. Control Opening Panel: When more buttons, plus buttons, dropdowns, or date pickers open corresponding menus or selectors, panels expand from the control's own corners. After expansion is mostly complete, internal items fade in sequentially with 25ms intervals; highlight block follows cursor or finger. When adding, deleting, or moving items, target items fall into corresponding positions, others shift to make space; jumping is forbidden.
8g. Tab Bar Switching: Top tabs, segmented controls, bottom bars, and side navigation share one selected capsule. During switching, the capsule's leading edge moves first, trailing edge follows, stretching during transit, compressing height by ~15% at longest point, restoring position upon arrival; text labels collapse or expand, adjacent items shift to make space, new content enters from the same side as the selected tab.
9h. Layout Rearrangement: When switching grid to list, sorting, swapping, inserting, deleting, expanding, or collapsing, each element moves from old coordinates to new coordinates; cross-row elements leave from end of original row and enter from start of next row; diagonal crossing of grid is forbidden.

This module writes eight common jump types into specific element correspondence tables. When AI scans code, it matches patterns a-h, clarifying which text scales, which images extend, and how much the background shrinks, saving the step of describing each page verbally.

3. Animation Rendering and Time Parameters

text
1【Animation Rendering and Time Parameters】
21. Single Element and Property: Motion subject reuses the same element or shared elements matched by ID via framework. Measure start and end bounding boxes; use only transform for translation and scaling; forbid animating width, height, top, or margin on elements that trigger page reflow.
32. Fade In/Out Timing: Content present only at start fades out within first 25%-35% progress; content present only at end fades in after 45%-55% displacement completion. Text changing font size scales directly; copying nodes for cross-fade is forbidden.
43. Layering and Rounded Corners: Expanded panels remain opaque; underlying text bleed-through is forbidden. Moving elements have higher z-index than neighbors during movement, restoring original layering after settling. Border radius transitions according to product corner curve; nested shapes maintain equidistant padding and concentric corners.
54. Duration and Curve: Expand and collapse use fast-start slow-end curve cubic-bezier(.32, .72, 0, 1) or existing product spring parameters. Mobile: Full-screen expand 450-700ms, menus/drawers 350-500ms, selected capsule movement 400-450ms. Desktop: Duration is two-thirds of mobile, further shortened for keyboard triggers. Internal same-screen displacement uses ease-in-out; list stagger interval controlled at 20-50ms.
65. Gestures and Interruption: During finger or cursor drag, screen follows 1:1; dragged card synchronously shrinks to 0.82; on release, inherit release velocity, sliding toward nearest end. If new action triggered mid-animation, take over from current frame; waiting for animation end is forbidden; locking input is forbidden.

These parameters solve three common frontend animation issues:

Prevent Frame Drops: Modifying width/height and margins forces browser to recalculate full-page layout every frame. Measure start/end positions first, use only transform for translation/scaling, offload calculation to GPU to avoid stutter.

雷电芽衣 - inline image

GIF

Prevent Ghosting: Simultaneous fading of old and new content creates blurry overlap. Old content exits in first third of journey, new content enters after halfway mark, keeping screen clean during transition.

雷电芽衣 - inline image

GIF

Prevent Lockup: Input is not locked during animation playback. If user clicks wrong page and hits back, animation reverses from current position; no need to wait for previous animation cycle to finish.

雷电芽衣 - inline image

GIF

4. Differences Between Mobile and Desktop

text
1【Differences Between Mobile and Desktop】
21. Mobile: Swipe-back, pull-down-close gestures, and click buttons drive the same animation set; every frame respects safe area boundaries.
32. Desktop: Smaller amplitude, faster speed. Cards or list rows expand into side panels or modals, growing from original card to target panel; scaling entire app window is forbidden. Mouse hover must not trigger layout shifts. Keep click hotspots in original position during animation to ensure consecutive clicks hit targets. Split views animate only within the changing pane.
43. Static Exemption: Window resizing and responsive breakpoint switches are not transitions; adding animation is forbidden.

Computer screens are larger, mouse travel distance shorter. Copying mobile full-screen scaling to desktop makes the whole software window shake visually, and animation durations feel too slow. This rule shortens desktop duration by one-third, limits animation to sidebars or local modals, and disables extra animations when dragging window edges.

雷电芽衣 - inline image

GIF

5. Accessibility and Acceptance Checklist

text
1【Accessibility and Acceptance Checklist】
21. Reduced Motion: When user enables system reduced motion, remove translation and scaling, keep only state switches and ~150ms fade in/out.
32. Accessibility Support: After opening new state, focus moves to title or first control; after closing, focus returns to trigger element; screen readers maintain original announcement logic.
43. Item-by-Item Self-Check: First and last frames coincide with real static states; no pixel jumps when moving elements hand off to real elements; test long text, short text, missing images, first item, last item, empty lists, scrolled lists; test rapid clicking, returning mid-animation, cancelling gesture drag halfway; verify mobile/desktop layouts, light/dark modes, reduced motion, keyboard operations, screen readers; static screen matches pre-modification, all original tests pass.

Animations often suffer from 1-2 pixel misalignment at start/end frames, or breakage with super-long titles/missing images. This checklist requires AI to verify with extreme data after each code change, while handling system "Reduced Motion" toggle and keyboard focus transfer.

雷电芽衣 - inline image

GIF

6. Platform Implementation Plans

text
1【Platform Implementation Plans】
21. Web: Check version, prioritize View Transitions API, set view-transition-name for shared elements, covering same-document and cross-document switches; degrade to direct update in unsupported environments. Other scenarios use FLIP mechanism: measure initial state, execute change, measure final state, reverse transition with transform; reuse Motion's layout/layoutId, Svelte's flip/crossfade, Vue's TransitionGroup. Route pages start transition from route navigation hooks.
32. iOS: SwiftUI same-view shared elements use matchedGeometryEffect; iOS 18+ Push and Sheet use navigationTransition(.zoom(sourceID:in:)) with matchedTransitionSource. UIKit on iOS 18 uses preferredTransition = .zoom; custom transitions supporting gesture interruption use UIViewControllerAnimatedTransitioning with UIViewPropertyAnimator.
43. Android: Compose uses SharedTransitionLayout with Modifier.sharedElement/sharedBounds, AnimatedContent, list item Modifier.animateItem; gesture back integrates Predictive Back; View system uses MaterialContainerTransform and shared element transitions.
54. Flutter: Cross-route shared elements use Hero; card expand page uses OpenContainer from animations package; layout rearrangement uses AnimatedList and implicit animations.
65. Desktop Apps: Electron and Tauri adopt Web plans; Tauri needs to test View Transitions compatibility in system WebView and retain degradation; native desktop apps call respective platform native animation interfaces using same coordinate measurement and interpolation rules.

Different tech stacks have their own official shared element APIs. Specifying standard APIs prevents AI from hand-writing timers to calculate coordinates. When actually putting into projects, keep only the one relevant to your current project.

雷电芽衣 - inline image

GIF

III. Complete Merged Prompt

Start a conversation in Cindy or Claude Code, copy the entire content below and send:

text
1# Interface Continuity Animation Modification Specification
2
3## 1. Modification Boundaries and Execution Flow
4- Modification Boundary: Modify within existing codebase, tech stack, components, design variables, and layout. Preserve original functionality, displayed content, and final positioning of each operation; only modify transition process between states. Operated elements must morph and move into next state; disappearing and reappearing is forbidden. Do not apply demo scenarios, add phone frames, background curtains, fake data, or extra fonts. Without asking, do not add third-party dependencies or modify routing architecture.
5- Inventory Current State: First read page, route, panel, drawer, modal, menu, and list code to determine existing animation solutions, duration curves, spring parameters, reduced motion logic, and input methods across platforms. Report results in a few sentences.
6- Diagnostic Ranking: Output list of up to 10 modification items based on operation frequency, user disorientation level, and modification cost. Each item includes: location and trigger platform, current behavior, corresponding pattern number and continuing elements, movement path and duration curve, value rating, code modification scope, and risk. High-frequency, easily disorienting, low-cost items come first. Stop after outputting list, ask which items I want to implement, and wait for reply.
7- Implement One by One: For selected items, explain implementation plan combined with current platform, list files to be modified, wait for confirmation, then write code. Change only one item at a time. After completion, list modified files and self-check against Section 5 item by item.
8
9## 2. Eight Types of Continuous Transition Patterns
10- a. Page Navigation: List row title continues as page title, row image extends as header image, previous page title collapses into back button. On page scroll, large title moves into top bar and centers in control row. Return follows same path backward.
11- b. Card Expansion: Card's own border, rounded corners, and image expand into body view or modal; title maintains same line text with font size scaling; other content fades in after card is mostly expanded. Close or pull-down shrinks back to same card in original position.
12- c. Mini Bar Expansion: Mini player bar, chat floating ball, upload/download capsule, or detail notification bar expands into full panel, with cover, title, and main button moving to new positions. Panel remains opaque; underlying page scales to 0.94 and darkens by 30%.
13- d. Search and Filter: Search box moves up to top bar, original page title exits, cancel or close button slides in; during input, matching items slide from original position to result list, others fade out. Same applies to command palette on desktop.
14- e. Data Summary Expansion: Data cards expand into charts, progress rings expand into reports, thumbnails expand into albums. Micro line charts become chart lines, small bars in cards continue as large bars in charts, labels move to title position, numbers scale proportionally; redrawing/replacing is forbidden.
15- f. Control Opening Panel: When more buttons, plus buttons, dropdowns, or date pickers open corresponding menus or selectors, panels expand from control's own corners. After expansion is mostly complete, internal items fade in sequentially with 25ms intervals; highlight block follows cursor or finger. When adding, deleting, or moving items, target items fall into corresponding positions, others shift to make space; jumping is forbidden.
16- g. Tab Bar Switching: Top tabs, segmented controls, bottom bars, and side navigation share one selected capsule. During switching, capsule's leading edge moves first, trailing edge follows, stretching during transit, compressing height by ~15% at longest point, restoring position upon arrival; text labels collapse or expand, adjacent items shift to make space, new content enters from same side as selected tab.
17- h. Layout Rearrangement: When switching grid to list, sorting, swapping, inserting, deleting, expanding, or collapsing, each element moves from old coordinates to new coordinates; cross-row elements leave from end of original row and enter from start of next row; diagonal crossing of grid is forbidden.
18
19## 3. Animation Rendering and Time Parameters
20- Single Element and Property: Motion subject reuses same element or shared elements matched by ID via framework. Measure start and end bounding boxes; use only transform for translation and scaling; forbid animating width, height, top, or margin on elements that trigger page reflow.
21- Fade In/Out Timing: Content present only at start fades out within first 25%-35% progress; content present only at end fades in after 45%-55% displacement completion. Text changing font size scales directly; copying nodes for cross-fade is forbidden.
22- Layering and Rounded Corners: Expanded panels remain opaque; underlying text bleed-through is forbidden. Moving elements have higher z-index than neighbors during movement, restoring original layering after settling. Border radius transitions according to product corner curve; nested shapes maintain equidistant padding and concentric corners.
23- Duration and Curve: Expand and collapse use fast-start slow-end curve cubic-bezier(.32, .72, 0, 1) or existing product spring parameters. Mobile: Full-screen expand 450-700ms, menus/drawers 350-500ms, selected capsule movement 400-450ms. Desktop: Duration is two-thirds of mobile, further shortened for keyboard triggers. Internal same-screen displacement uses ease-in-out; list stagger interval controlled at 20-50ms.
24- Gestures and Interruption: During finger or cursor drag, screen follows 1:1; dragged card synchronously shrinks to 0.82; on release, inherit release velocity, sliding toward nearest end. If new action triggered mid-animation, take over from current frame; waiting for animation end is forbidden; locking input is forbidden.
25
26## 4. Differences Between Mobile and Desktop
27- Mobile: Swipe-back, pull-down-close gestures, and click buttons drive same animation set; every frame respects safe area boundaries.
28- Desktop: Smaller amplitude, faster speed. Cards or list rows expand into side panels or modals, growing from original card to target panel; scaling entire app window is forbidden. Mouse hover must not trigger layout shifts. Keep click hotspots in original position during animation to ensure consecutive clicks hit targets. Split views animate only within changing pane.
29- Static Exemption: Window resizing and responsive breakpoint switches are not transitions; adding animation is forbidden.
30
31## 5. Accessibility and Acceptance Checklist
32- Reduced Motion: When user enables system reduced motion, remove translation and scaling, keep only state switches and ~150ms fade in/out.
33- Accessibility Support: After opening new state, focus moves to title or first control; after closing, focus returns to trigger element; screen readers maintain original announcement logic.
34- Item-by-Item Self-Check: First and last frames coincide with real static states; no pixel jumps when moving elements hand off to real elements; test long text, short text, missing images, first item, last item, empty lists, scrolled lists; test rapid clicking, returning mid-animation, cancelling gesture drag halfway; verify mobile/desktop layouts, light/dark modes, reduced motion, keyboard operations, screen readers; static screen matches pre-modification, all original tests pass.
35
36## 6. Platform Implementation Plans
37- Web: Check version, prioritize View Transitions API, set view-transition-name for shared elements, covering same-document and cross-document switches; degrade to direct update in unsupported environments. Other scenarios use FLIP mechanism: measure initial state, execute change, measure final state, reverse transition with transform; reuse Motion's layout/layoutId, Svelte's flip/crossfade, Vue's TransitionGroup. Route pages start transition from route navigation hooks.
38- iOS: SwiftUI same-view shared elements use matchedGeometryEffect; iOS 18+ Push and Sheet use navigationTransition(.zoom(sourceID:in:)) with matchedTransitionSource. UIKit on iOS 18 uses preferredTransition = .zoom; custom transitions supporting gesture interruption use UIViewControllerAnimatedTransitioning with UIViewPropertyAnimator.
39- Android: Compose uses SharedTransitionLayout with Modifier.sharedElement/sharedBounds, AnimatedContent, list item Modifier.animateItem; gesture back integrates Predictive Back; View system uses MaterialContainerTransform and shared element transitions.
40- Flutter: Cross-route shared elements use Hero; card expand page uses OpenContainer from animations package; layout rearrangement uses AnimatedList and implicit animations.
41- Desktop Apps: Electron and Tauri adopt Web plans; Tauri needs to test View Transitions compatibility in system WebView and retain degradation; native desktop apps call respective platform native animation interfaces using same coordinate measurement and interpolation rules.

IV. Practical Steps

  1. Send specification to get list: Start AI programming tool in project root directory, paste complete merged Prompt, wait for AI to read code and output top 10 modification list.
  2. Pick two or three to do first: From highest-value, lowest-cost items at top, pick 2-3, reply with corresponding numbers, verify files listed by AI, then let it modify one by one.
  3. Run program for three checks: After each modification, open interface and test three actions—slow drag to check for flicker at start/end handoff, click return mid-animation to check if it can reverse, enable system "Reduced Motion" to check if translation is disabled. Submit code after passing checks, continue to next item.
One-click save

Use YouMind for AI deep reading of viral articles

Save the source, ask focused questions, summarize the argument, and turn a viral article into reusable notes in one AI workspace.

Explore YouMind
For creators

Turn your Markdown into a clean 𝕏 article

When you publish your own long-form writing, images, tables, and code blocks make 𝕏 formatting painful. YouMind turns a full Markdown draft into a clean, ready-to-post 𝕏 article.

Try Markdown to 𝕏

More patterns to decode

Recent viral articles

Explore more viral articles