Duo Transitionsのロゴ

Duo Transitions

コミュニティ
Kimeur
duo-transitions

Makes fold, unfold, partial fold and rotation on iPhone Duo, Apple's foldable, feel like one app instead of a reload. Use when a screen flashes, blinks, jumps, reloads, pops or moves its controls as the phone opens or closes, or when writing or reviewing SwiftUI or UIKit code that animates a resize: AnyLayout, stable ForEach IDs, matchedGeometryEffect, geometryGroup, .animation(_:value:), transaction, withAnimation, contentTransition, accessibilityReduceMotion, viewWillTransition(to:with:), animate(alongsideTransition:completion:), UIView.animate with a SwiftUI spring, and 120 Hz ProMotion frame budgets.

概要

公開者Kimeur
リポジトリduology
スキル名duo-transitions
スター
40
フォーク
2
同梱ファイル
4
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    KimeurがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Duo Transitions」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/Kimeur/duology/tree/main/plugins/duology-design/skills/duo-transitions
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Kimeur/duology.git /tmp/duology
mkdir -p .claude/skills
cp -r /tmp/duology/plugins/duology-design/skills/duo-transitions .claude/skills/duo-transitions
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDuo Transitionsを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にDuo Transitionsを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Duo Transitionsは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

duo-transitions

Opening or closing iPhone Duo resizes your app, the same way a person resizes it in iPhone Mirroring (Tech Talk 111461). People do it often, so Apple asks for an app that stays predictable and consistent inside and out (Tech Talk 111466). This skill makes the change read as the same screen taking a new shape, not a new screen loading.

Load other skills for neighbouring work: duo-continuity (scroll, selection, typing and playback that must survive), duo-patterns (layouts, and displacement off the fold), duo-layout (size classes, reserved regions), duo-navigation (bars move on their own).

Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1), pressing Device Hub's pose buttons; see references/evidence.md. Unverified means we could not confirm it. Device only means the simulator can't show it. Everything else comes from Apple's pages, linked inline. Full source list: reference/sources.md.

What each change hands your app

All measured:

ChangeWindowSize classUIKit coordinatorSwiftUI transaction
Open466 × 678 → 951 × 669 pt, other displaycompact → regular. From closed portrait: same update as the new size (2 runs). From closed sideways: about 16 ms before it (1 run)not animated, duration 0no animation
Close951 × 669 → 466 × 678 pt, other displayregular → compact, 25 to 70 ms before the new sizenot animated, duration 0no animation
Partially openno changeno changeno callthe fold region turns active once the hinge settles
Rotatewidth and height swapvertical class flips on the closed phoneanimated, 0.3 sno animation
  • A fold keeps your app running: one root view, no relaunch, and the scene never left the active state.
  • On open and close the system adds no motion to your layout. Any motion there is motion you add.
  • Sizes arrive in steps. On open, a full-width view went 382 → 466 → 951 → 867 pt wide within 50 to 250 ms, as safe area insets changed around the resize.
  • The trait change and the size transition come in no fixed order. Never write code that expects one first.

How SwiftUI animates a resize

  1. Every update runs in a transaction. When an animatable value changes (a frame, an offset, an opacity), SwiftUI checks the transaction for an animation. With one, it interpolates from the old value to the new one. Without one, the value jumps (WWDC23 Explore SwiftUI animation).
  2. withAnimation puts an animation in the transaction of a state change you make. A fold is not your state change. The system resizes the window and updates horizontalSizeClass; none of your code runs first, so there is nothing to wrap. Measured: open, close and rotation all reached SwiftUI with no animation, even though a rotation runs body inside UIKit's 0.3 s animation.
  3. So read the size class, or the view's size, in body and build the layout from it. The layout then changes in the very update that brings the new size class.
  4. Opt in with animation(_:value:). When value changes in an update, the views below the modifier animate in that update. Key it on a discrete value: the width class, a column count, the fold's active state. Never on the raw size. Measured: the opt-in interpolated on open, close, rotation and partial fold; a probe without it jumped.
  5. Opt out below an animation: .animation(nil, value:) for a subtree, transaction(_:) with $0.animation = nil for one leaf (Apple says to use it on leaf views), and contentTransition(.identity) to stop a text or symbol cross-fade while its frame still moves. Measured: both opt-outs stopped the opt-in.
  6. Frames animate at the leaf views that draw. An opt-out on a container also stops that container's frame. geometryGroup() makes a group animate as one frame.
swift
import SwiftUI

struct NowPlayingScreen: View {
    @Environment(\.horizontalSizeClass) private var widthClass
    @Environment(\.accessibilityReduceMotion) private var reduceMotion

    var body: some View {
        // Read in body, so the arrangement changes in the update that brings the size class.
        let isWide = widthClass == .regular
        let layout = isWide
            ? AnyLayout(HStackLayout(alignment: .center, spacing: 24))
            : AnyLayout(VStackLayout(spacing: 16))
        layout {
            Artwork()            // the same view in both layouts: it moves, it doesn't reload
            PlaybackControls()
        }
        // Opt in: short, no bounce, keyed on a discrete value. Nil under Reduce Motion.
        .animation(reduceMotion ? nil : .smooth(duration: 0.3), value: isWide)
    }
}

Should open and close animate?

Open and close move your window to the other display, and nothing animates unless you ask. With the opt-in above, SwiftUI moves each view from where it sat in the old window to its new place. On open, the closed layout starts in the left part of the inner display, about as wide as the outer display, and grows into the open layout. That follows from how SwiftUI interpolates; we have not recorded it (unverified).

  • Apple's motion guidance says to avoid adding motion to interactions people repeat often, and not to make people wait for an animation (HIG, Motion). People open and close iPhone Duo often.
  • So: a short spring (0.3 s, no bounce) or none. Never a long or bouncy one, never a delayed one.
  • Whether the short spring reads as "the app unfolds with the phone" or as lag is device only. Until you have tested on hardware, keep it short.
  • Continuity comes first from identity: the same views, the same controls in the same order and style, the reader's place kept. Motion only helps people follow what moved.
  • Rotation, a partial fold and Split View stay on one display. There, motion helps. The system already animates rotation; animate controls you move off the fold yourself (duo-patterns, displacement).

Don't copy the size class into state

swift
// Bad: a second source of truth, and wrong at launch.
struct NowPlayingScreenCopy: View {
    @Environment(\.horizontalSizeClass) private var widthClass
    @State private var isWide = false          // a copy of the size class

    var body: some View {
        let layout = isWide ? AnyLayout(HStackLayout()) : AnyLayout(VStackLayout())
        layout {
            Artwork()
            PlaybackControls()
        }
        .onChange(of: widthClass) { _, newClass in
            withAnimation(.smooth) { isWide = newClass == .regular }
        }
    }
}
  • Measured: the copy started animating in the same frame as .animation(_:value:), so lateness is not the problem.
  • The problems: an app launched open shows the stacked layout until the next fold, because onChange without initial: true never ran; two values that can disagree; and a second body pass on every fold.
  • The same goes for DispatchQueue.main.asyncAfter, Task.sleep before a state change, or an animation started in onAppear: each animates after the resize, so people see the window change and then the content move. One measured exception isn't an animation: long text that reflows while the margins arrive late needs a scroll back to its saved paragraph after the width settles (duo-continuity section 4, the gallery's fold transition screen).
  • When a value only exists after layout (the fold's frame, an exact width), use onGeometryChange(for:of:action:). Return a small value (a column count, a fold flag), write it in one cheap action, and key the animation on it. Measured: on the two opens from closed portrait, its action ran in the same millisecond as the size-class update. On the open from the closed phone held sideways, it ran about 16 ms after it, once the width changed.

Rules

  1. Same views, new places. Switch layouts with AnyLayout, ArrangementView or one container, and give ForEach stable IDs. A branch on size class, a ViewThatFits that swaps children, or an .id fed by layout creates new views. New views can't move from their old frame: they fade or pop, and lose their state (AnyLayout, WWDC21 Demystify SwiftUI, duo-continuity).
  2. Change with the size, not after it. Derive layout in body. In UIKit, change layout inside the coordinator's alongside block.
  3. Controls keep their place and their look. Same symbol, title, order, style and tint at every size. Keep their positions relative to each other as similar as you can across poses (HIG, Vertical controls). Keep a control's edge: bottom stays bottom. Move one only to clear the fold, to the nearest region (duo-patterns, displacement).
  4. Small moves, one property at a time. Favour small adjustments over rearranging (HIG, Reserved regions). Moving an element far from where it was weakens its link to the content (talk 111463). Don't change a control's position, size and style in one change.
  5. No reload flash. See the table below.
  6. Keep the reader's place. Scrolling content is not displaced (talk 111463). Anchor scroll views by item ID; keep selection in a model (duo-continuity).
  7. Let the system animate its own parts. Sheets, alerts, menus and toolbar buttons move off the fold on their own (talk 111466), and split view columns adapt their widths (HIG, Reserved regions). Don't animate them again.
  8. Respect Reduce Motion. See below.
  9. Keep each update cheap. At 120 Hz a frame has about 8.3 ms (Understanding hitches), and a fold lays out the whole window at once.

No reload flash

You seeUsual causeFix
A blank or white frameA background that differs by size class, or a view rebuilt before it has contentOne background for every size; stable identity
A spinner or placeholderA fetch in onAppear or .task that runs again because the view was rebuilt, or .task(id:) keyed on sizeLoad once, in a model (duo-continuity)
Images blinkAsyncImage rebuilt, so it starts empty and loads againStable identity; keep loaded images in a model or cache
Everything fades inonAppear { withAnimation { opacity = 1 } } on a layout viewNo appearance animation on views a fold rebuilds
The list jumps to the topNew identity, or a saved offset restoredScrollPosition by item ID (duo-continuity)
UIKit cells flashreloadData() or new child view controllers on a trait changeInvalidate the layout inside the coordinator

SwiftUI patterns

Full code for each, and the measured transaction rules: references/swiftui.md.

NeedPattern
Stacked closed, side by side openAnyLayout and .animation(_:value:), above
A pane that only exists openif isWide inside a container that never changes, .transition(.opacity)
One picture that changes container (mini player artwork into a player pane)matchedGeometryEffect on that stateless element only
Grid columnsStable ForEach IDs, the animation keyed on the column count
Controls off the foldFoldGeometry and .animation(.smooth, value: fold), from duo-patterns
Text that changes with the size.contentTransition(.identity), or .interpolate for a size change of the same string
A part that must snap.animation(nil, value:) on it, under the animated parent
Check what a change hands a viewAnimationProbe, a debug-only Animatable modifier

UIKit

swift
import UIKit

final class PlayerViewController: UIViewController {
    private var tallConstraints: [NSLayoutConstraint] = []
    private var wideConstraints: [NSLayoutConstraint] = []

    override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
        super.viewWillTransition(to: size, with: coordinator)
        let isWide = size.width > size.height          // decide from the size you are handed
        coordinator.animate(alongsideTransition: { _ in
            self.applyLayout(isWide: isWide)           // same views, new constraints
            self.view.layoutIfNeeded()                 // rotation: rides the system's animation
        })
    }

    private func applyLayout(isWide: Bool) {
        NSLayoutConstraint.deactivate(isWide ? tallConstraints : wideConstraints)
        NSLayoutConstraint.activate(isWide ? wideConstraints : tallConstraints)
    }
}
  • viewWillTransition(to:with:) runs before the size changes. Always call super. Blocks you pass to animate(alongsideTransition:completion:) run in the transition's own animation context.
  • Measured: on rotation that context lasts 0.3 s, so the layout glides with the window. On open and close the coordinator says isAnimated false with duration 0, so the layout lands at once, together with the resize.
  • Collection views: invalidate the layout inside the alongside block. Never call reloadData() there. Keep the top item in view as duo-continuity shows.
  • A partial fold has no coordinator. Read reserved regions in the layoutSubviews of the view that lays out around the fold. UIKit runs that pass again when the fold turns active or inactive (measured in duo-postures). Don't trigger layout from UIHingeInteraction: when folding, the status changes 0.7 to 0.9 s before the region does. Work out the place on every pass, because a resize moves it too. Animate only when the fold changed and the window kept its size, with UIView.animate(_:changes:completion:) (iOS 18), which takes a SwiftUI Animation. It is declared in SwiftUI, so the file needs import SwiftUI.
  • Optional motion on open and close, the partial-fold recipe and Reduce Motion: references/uikit.md.

Reduce Motion

  • Apple's guidance: replace movement along x, y and z with fades, tighten springs, avoid animating depth and blur, and let animations track gestures directly (HIG, Accessibility).
  • Read it: SwiftUI accessibilityReduceMotion, and accessibilityPrefersCrossFadeTransitions from iOS 26.4. UIKit UIAccessibility.isReduceMotionEnabled and UIAccessibility.prefersCrossFadeTransitions.
  • For a fold: layout moves get no animation, so views take their new place at once. A pane that appears gets a short fade. Effects driven by the hinge angle (zoom, parallax, tilt) turn off.
swift
extension Animation {
    /// The animation for a layout change caused by a fold or a resize.
    /// Nil under Reduce Motion: views take their new place at once.
    static func resize(reduceMotion: Bool) -> Animation? {
        reduceMotion ? nil : .smooth(duration: 0.3)
    }
}

Measured: a transition with its own .animation(_:) ran its full length on a size-class change that carried no animation. So .transition(.opacity.animation(.easeInOut(duration: 0.2))) still fades a new pane when the layout animation is nil.

120 Hz ProMotion

  • Both displays have ProMotion up to 120 Hz (specs). SwiftUI, UIKit and Core Animation pace their animations for it on their own (Optimizing ProMotion). A .smooth spring needs no extra code.
  • The budget is the hard part: about 8.3 ms per frame for your main thread. Keep body free of sorting, filtering, formatting and image decoding. Don't put a GeometryReader in every row. Use lazy stacks for long content.
  • Custom per-frame drawing with CADisplayLink: set preferredFrameRateRange, pace by targetTimestamp, and add CADisableMinimumFrameDurationOnPhone to Info.plist, or iPhone stays at its default rate for it. Code: references/performance.md.
  • The hinge angle streams continuously. Use it for effects, never to run layout every update (talk 111464).
  • The simulator reports maximumFramesPerSecond = 60 (device facts). It can't show 120 Hz or hitches.

What not to animate

Don't animateWhyInstead
Scroll position, or a feed moving between halvesScrolling content already adapts; moving it breaks continuityAnchor by item ID; let it reflow
Sheets, alerts, menus, bars, split view columnsThe system moves them already; a second motion fights itNothing
The raw window sizeIt arrives in several steps per fold (measured); each one retargetsA discrete key: width class, column count, fold state
Layout from the hinge angleA continuous stream, meant for effectsReserved regions and arrangements
First appearance after a foldReads as a reloadNothing; a short fade only for a pane that is new
A different background or font size per displayA flash, and text that cross-fadesOne background; the same type size
Position, size and style of one control togetherHard to followMove it; keep its look
Zoom, 3D or blur on resizeUncomfortable, and Reduce Motion asks you not toA plain move or a fade

What only a real device shows

  • What the hardware shows while the displays hand over, and whether your first frame on the new display looks continuous with it. The simulator can't show the hardware hand-over.
  • Whether a short spring on open and close reads as unfolding or as lag.
  • Smoothness at 120 Hz and hitches during open and close. The simulator tops out at 60.
  • How a spring feels at the speed people really open the phone.
  • Frame rates that drop in Low Power Mode or when the phone is hot (Optimizing ProMotion).

Until Duology has run on hardware, its metadata.verified says device: no. Say so in your own review notes.

Test it

  1. In Device Hub, choose Device > Slow Animations (Device Hub). Press Closed, Open and Partially Open, rotate, and drag the app into Split View.
  2. Record the display that lights up: start xcrun simctl io <UDID> recordVideo --display=primary-1 --force open.mov, press Open, then stop it with Ctrl-C. Use --display=primary for Closed. Step through it frame by frame. Look for a blank frame, a pop then a glide, a jump to the top, a control that vanishes and comes back.
  3. While debugging, add AnimationProbe (references/swiftui.md) to see whether a change reaches a view animated.
  4. Turn on Reduce Motion in the simulator's Settings and repeat steps 1 and 2.
  5. On a device, profile open and close with the Hitches instrument (references/performance.md).

Red flags in review

  • withAnimation in onChange(of: horizontalSizeClass) that copies the size class into @State
  • .animation(_:value:) keyed on proxy.size, a width or a CGSize; a long or bouncy spring on a size-class change
  • if sizeClass == .compact { A } else { B } with the same views in both branches; .id(sizeClass)
  • DispatchQueue.main.asyncAfter, Task.sleep or onAppear animations after a size change
  • A background colour, font size or button style chosen by size class
  • UIKit: layout changes in the coordinator's completion block on rotation; reloadData() in viewWillTransition(to:with:) or a trait handler; code that expects the trait change before the size change, or after it
  • No accessibilityReduceMotion or isReduceMotionEnabled check next to custom motion

Checklist

  • Layout comes from the size class or the view's size, read in body; no copy of the size class in @State.
  • Layout switches keep identity: AnyLayout, ArrangementView or one container; stable ForEach IDs; no .id fed by layout.
  • Every .animation(_:value:) is keyed on a discrete value, never on the raw size.
  • Open and close get a short spring (about 0.3 s, no bounce) or no animation; never a delayed one.
  • Parts that must snap opt out with .animation(nil, value:), a leaf transaction, or contentTransition(.identity).
  • Controls keep their symbol, title, order, style and tint at every size, and keep their edge.
  • No blank frame, spinner, blinking image or fade-in after close, open or rotate.
  • Scroll position and selection survive (duo-continuity).
  • UIKit layout changes run inside animate(alongsideTransition:completion:); no reloadData() on a resize; no assumed order of trait and size changes.
  • Reduce Motion: no movement, short fades only; hinge effects off.
  • body does no heavy work; custom display links use preferredFrameRateRange and targetTimestamp.
  • Checked in Device Hub with Slow Animations and in a recording of each display. Smoothness at 120 Hz and the feel of open and close left for a device, and said so.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Duo Transitions」では何ができますか?

Makes fold, unfold, partial fold and rotation on iPhone Duo, Apple's foldable, feel like one app instead of a reload. Use when a screen flashes, blinks, jumps, reloads, pops or moves its controls as the phone opens or closes, or when writing or reviewing SwiftUI or UIKit code that animates a resize: AnyLayout, stable ForEach IDs, matchedGeometryEffect, geometryGroup, .animation(_:value:), transaction, withAnimation, contentTransition, accessibilityReduceMotion, viewWillTransition(to:with:), animate(alongsideTransition:completion:), UIView.animate with a SwiftUI spring, and 120 Hz ProMotion...

TypingMindでDuo Transitionsを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Duo Transitionsはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDuo Transitionsをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/Kimeur/duology/tree/main/plugins/duology-design/skills/duo-transitionsを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Duo Transitionsを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Duo Transitionsで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDuo Transitionsを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Duo Transitions」は無料ですか?

はい。KimeurがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇