モーションの原則
基礎。すべてのクリエイティブスキル呼び出し時に読み込まれます。 ここには簡潔なルールを記載。詳細は
references/を参照。
タイミングルール
| コンテキスト | 時間 | 理由 |
|---|---|---|
| マイクロインタラクション(トグル、ホバー、フォーカス) | 100-150ms | 即時フィードバック、知覚遅延なし |
| UI 遷移(モーダル、ドロワー、タブ切り替え) | 200-300ms | スムーズだが決してもたつかない |
| ページ/ルート遷移 | 300-500ms | 空間的なナラティブを確立 |
| スクロール駆動 / 3D | 自由(進行ベース) | ユーザー入力に紐づき、固定時間なし |
頻度ルール: アニメーションが頻繁に再生されるほど、より短く控えめにする必要があります。 ボタンのホバー(1日1000回)= 100ms の透明度。オンボーディングのリビール(1回のみ)= 600ms+ の本格的な演出。
イージング早見表
| アクション | イージング | 理由 |
|---|---|---|
| 要素の出現 | ease-out / スプリング | 静止位置に減速(自然な到着) |
| 要素の消滅 | ease-in | 加速して離脱(邪魔にならない) |
| 状態間の移動 | ease-in-out | スムーズな開始と停止 |
| スクロール同期 | linear / none | 入力と1:1で一致、ラグ知覚なし |
| バウンス/遊び心 | スプリング(減衰不足) | オーバーシュートが生命感を付与 |
| スナップ UI | cubic-bezier(0.2, 0, 0, 1) | 素早い開始、スムーズな着地 |
消滅は常に出現より控えめに。 出現: 300ms ease-out、本格的な演出。消滅: 200ms ease-in、透明度のみ。
ネイティブイージングの同等表現(クロスプラットフォーム)
| Web (CSS / JS) | SwiftUI | Compose |
|---|---|---|
cubic-bezier(0.2, 0, 0, 1) | .spring(response: 0.4, dampingFraction: 0.85) または .snappy | spring(stiffness = Spring.StiffnessMedium, dampingRatio = 0.85f) |
ease-out | .easeOut(duration: 0.3) | tween(durationMillis = 300, easing = LinearOutSlowInEasing) |
ease-in | .easeIn(duration: 0.2) | tween(durationMillis = 200, easing = FastOutLinearInEasing) |
| スプリング(バウンス) | .bouncy (iOS 17+) | spring(stiffness = Spring.StiffnessLow, dampingRatio = Spring.DampingRatioMediumBouncy) |
| スプリング(スムーズ) | .smooth (iOS 17+) | spring(stiffness = Spring.StiffnessMedium, dampingRatio = Spring.DampingRatioNoBouncy) |
アクセシビリティ(必須)
動きの抑制 - 必須
すべてのアニメーションコンポーネントは、ユーザーの動きの抑制設定を尊重しなければなりません。プラットフォームに関わらず、例外はありません。
| プラットフォーム | API |
|---|---|
| Web CSS | @media (prefers-reduced-motion: reduce) |
| Web JS | window.matchMedia('(prefers-reduced-motion: reduce)') |
| SwiftUI | @Environment(\.accessibilityReduceMotion) var reduceMotion |
| UIKit | UIAccessibility.isReduceMotionEnabled (+ reduceMotionStatusDidChangeNotification) |
| Compose | Settings.Global.ANIMATOR_DURATION_SCALE を使用したカスタムヘルパー(詳細は mobile-principles/references/accessibility-mobile.md) |
CSS:
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
SwiftUI:
struct AnimatedView: View {
@Environment(\.accessibilityReduceMotion) var reduceMotion
@State var visible = false
var body: some View {
Text("Hello")
.opacity(visible ? 1 : 0)
.animation(reduceMotion ? .none : .spring(response: 0.4, dampingFraction: 0.85), value: visible)
}
}
Compose:
@Composable
fun rememberReduceMotion(): Boolean {
val context = LocalContext.current
return remember {
Settings.Global.getFloat(context.contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f) == 0f
}
}
@Composable
fun AnimatedComponent(visible: Boolean) {
val reduce = rememberReduceMotion()
val alpha by animateFloatAsState(
targetValue = if (visible) 1f else 0f,
animationSpec = if (reduce) snap() else spring(stiffness = Spring.StiffnessMedium)
)
}
その他のアクセシビリティ要件
- フォーカスインジケータがアニメーションによって隠されてはならない
- アニメーションコンテンツはすべてのフレームで WCAG のコントラスト比を満たすこと(遷移途中でテキストが見えなくなるようなフェードアウトは禁止)
- ループするアニメーションには、一時停止機能を提供すること
ユニバーサル「禁止」ルール
1. width/height/top/left はアニメーション禁止
フレームごとにレイアウトの再計算が発生し、カクつきの原因になります。
/* 悪い例 */
.drawer { transition: height 0.3s ease; }
.drawer.open { height: 400px; }
/* 良い例 */
.drawer { transition: transform 0.3s ease-out; transform: translateY(100%); }
.drawer.open { transform: translateY(0); }
SwiftUI での同等表現(悪い例 vs 良い例):
// 悪い例 - フレームをアニメーション(レイアウトパスが発生)
.frame(height: open ? 400 : 0)
.animation(.easeInOut, value: open)
// 良い例 - オフセットでtransformをアニメーション
.offset(y: open ? 0 : 400)
.animation(.spring(), value: open)
Compose での同等表現(悪い例 vs 良い例):
// 悪い例 - サイズをアニメーション(完全なレイアウトパス)
val height by animateDpAsState(if (open) 400.dp else 0.dp)
// 良い例 - graphicsLayerでYオフセットをアニメーション
val translation by animateFloatAsState(if (open) 0f else 400f)
Box(modifier = Modifier.graphicsLayer { translationY = translation })
2. scale(0) へのスケール禁止
scale(0) は要素をブラックホールのように消し去ります。常に最小値を維持すること。
/* 悪い例 */
.modal-exit { transform: scale(0); }
/* 良い例 */
.modal-exit { transform: scale(0.95); opacity: 0; }
SwiftUI での同等表現:
// 悪い例
.scaleEffect(visible ? 1.0 : 0.0)
// 良い例
.scaleEffect(visible ? 1.0 : 0.95)
.opacity(visible ? 1.0 : 0.0)
Compose での同等表現:
// 悪い例
Modifier.graphicsLayer { scaleX = if (visible) 1f else 0f; scaleY = if (visible) 1f else 0f }
// 良い例
Modifier.graphicsLayer {
scaleX = if (visible) 1f else 0.95f
scaleY = if (visible) 1f else 0.95f
alpha = if (visible) 1f else 0f
}
3. 出現時に ease-in は禁止
Ease-in = 開始が遅い。出現する要素がためらうのは、壊れているように感じられます。
/* 悪い例 */
.card-enter { animation: fadeIn 0.3s ease-in; }
/* 良い例 */
.card-enter { animation: fadeIn 0.3s ease-out; }
/* または JS でスプリングを使用して自然な感触に */
4. UI インタラクションで 500ms を超えないこと
モーダル、ドロップダウン、ツールチップ、タブ -- ユーザーは待っています。ユーザーの時間を尊重しましょう。
// 悪い例
gsap.to(modal, { opacity: 1, y: 0, duration: 0.8 });
// 良い例
gsap.to(modal, { opacity: 1, y: 0, duration: 0.25, ease: "power2.out" });
SwiftUI:
// 悪い例
.animation(.easeInOut(duration: 0.8), value: state)
// 良い例
.animation(.spring(response: 0.25, dampingFraction: 0.85), value: state)
Compose:
// 悪い例
animateContentSize(animationSpec = tween(800))
// 良い例
animateContentSize(animationSpec = spring(stiffness = Spring.StiffnessMediumLow))
5. prefers-reduced-motion をスキップしないこと
これはアクセシビリティ要件であり、あれば良いというものではありません。
// 悪い例
gsap.from('.hero-title', { opacity: 0, y: 40, duration: 0.6 });
// 良い例
const prefersReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!prefersReduced) {
gsap.from('.hero-title', { opacity: 0, y: 40, duration: 0.6 });
}
クロスプラットフォームの動きの抑制セクション(上記)で、SwiftUI / Compose の同等表現を参照してください。
パフォーマンスチェックリスト
transformとopacity(コンポジットのみのプロパティ)のみをアニメーションさせるwill-changeは控えめに使い、アニメーション完了後に削除する- JS アニメーションでは
setTimeout/setIntervalよりrequestAnimationFrameを優先する - スクロール駆動の場合: CSS
animation-timeline> JSIntersectionObserver> scroll リスナー - 低スペック端末でテストする(DevTools で CPU を 4倍にスロットルする)
クイックリファレンス: サブスキルの読み込み
| ニーズ | 読み込むもの |
|---|---|
| イージングの詳細、スプリング設定 | references/easing-guide.md |
| コピペで使える出現/消滅パターン | references/enter-exit-recipes.md |
| デザイナーが重視するスタイル選択 | references/designers.md |
| モバイル UX コンテキスト | ../mobile-principles/SKILL.md |
| デスクトップ UX コンテキスト | ../desktop-principles/SKILL.md |
| GSAP 固有の情報 | ../gsap/SKILL.md |
| Framer Motion 固有の情報 | ../framer-motion/SKILL.md |
| CSS のみのアニメーション | ../css-native/SKILL.md |
| Three.js / R3F | ../threejs-r3f/SKILL.md |
| Canvas / ジェネレーティブ | ../canvas-generative/SKILL.md |
| Compose Android アニメーション | ../compose-motion/SKILL.md |
| Compose Multiplatform | ../compose-multiplatform/SKILL.md |
| SwiftUI iOS/macOS アニメーション | ../swiftui-motion/SKILL.md |
| Compose 高度なグラフィックス | ../compose-graphics/SKILL.md |
| SwiftUI 高度なグラフィックス | ../swiftui-graphics/SKILL.md |
| ビジュアル / モーション / a11y 監査 | ../design-audit/SKILL.md |
| UI/UX インテリジェンス(84スタイル、192パレット) | ../ui-ux-pro-max/SKILL.md |