Princípios de Motion Design
A base. Carregado em toda invocação de skill criativa. Regras concisas aqui. Aprofundamento em
references/.
Regras de Timing
| Contexto | Duração | Porquê |
|---|---|---|
| Micro-interação (toggle, hover, focus) | 100–150ms | Feedback instantâneo, sem atraso percebido |
| Transição UI (modal, drawer, troca de aba) | 200–300ms | Suave, mas nunca lenta |
| Transição de página/rota | 300–500ms | Estabelece narrativa espacial |
| Acionada por scroll / 3D | Livre (baseada em progresso) | Atrelada à entrada do usuário, sem duração fixa |
Regra de frequência: Quanto mais frequente a animação, mais curta e sutil deve ser. Um hover em botão (1000x/dia) = 100ms de opacidade. Um reveal de onboarding (1x total) = 600ms+ com coreografia completa.
Tabela de Easing
| Ação | Easing | Porquê |
|---|---|---|
| Elemento entra | ease-out / spring | Desacelera até a posição de repouso (chegada natural) |
| Elemento sai | ease-in | Acelera para sair (sai do caminho) |
| Elemento se move entre estados | ease-in-out | Início e parada suaves |
| Sincronizado com scroll | linear / none | Combina 1:1 com a entrada, sem percepção de lag |
| Saltitante/divertido | spring (subamortecido) | Overshoot cria vida |
| UI rápida | cubic-bezier(0.2, 0, 0, 1) | Início rápido, aterrissagem suave |
A saída é sempre mais sutil que a entrada. Entrada: 300ms ease-out, coreografia completa. Saída: 200ms ease-in, apenas opacidade.
Equivalentes de easing nativos (multiplataforma)
| Web (CSS / JS) | SwiftUI | Compose |
|---|---|---|
cubic-bezier(0.2, 0, 0, 1) | .spring(response: 0.4, dampingFraction: 0.85) ou .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) |
| spring (saltitante) | .bouncy (iOS 17+) | spring(stiffness = Spring.StiffnessLow, dampingRatio = Spring.DampingRatioMediumBouncy) |
| spring (suave) | .smooth (iOS 17+) | spring(stiffness = Spring.StiffnessMedium, dampingRatio = Spring.DampingRatioNoBouncy) |
Acessibilidade (Inegociável)
Movimento reduzido — OBRIGATÓRIO
Todo componente animado deve respeitar a preferência de movimento reduzido do usuário. Sem exceções, independente da plataforma.
| Plataforma | 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 | Helper customizado usando Settings.Global.ANIMATOR_DURATION_SCALE (aprofundamento em 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("Olá")
.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)
)
}
Outros requisitos de acessibilidade
- Indicadores de foco nunca devem ser ocultados por animações
- Conteúdo animado deve atender às taxas de contraste WCAG em cada frame (sem desbotamento para texto invisível durante a transição)
- Animações em loop: fornecer mecanismo de pausa
Regras Universais de "Não Fazer"
1. Nunca animar width/height/top/left
Dispara recálculo de layout a cada quadro = travamentos.
/* RUIM */
.drawer { transition: height 0.3s ease; }
.drawer.open { height: 400px; }
/* BOM */
.drawer { transition: transform 0.3s ease-out; transform: translateY(100%); }
.drawer.open { transform: translateY(0); }
Equivalente SwiftUI (RUIM vs BOM):
// RUIM - anima frame (causa passagem de layout)
.frame(height: open ? 400 : 0)
.animation(.easeInOut, value: open)
// BOM - anima transform via offset
.offset(y: open ? 0 : 400)
.animation(.spring(), value: open)
Equivalente Compose (RUIM vs BOM):
// RUIM - anima tamanho (passagem completa de layout)
val height by animateDpAsState(if (open) 400.dp else 0.dp)
// BOM - anima deslocamento Y via graphicsLayer
val translation by animateFloatAsState(if (open) 0f else 400f)
Box(modifier = Modifier.graphicsLayer { translationY = translation })
2. Nunca escalar para 0
scale(0) faz elementos desaparecerem em um buraco negro. Sempre mantenha um mínimo.
/* RUIM */
.modal-exit { transform: scale(0); }
/* BOM */
.modal-exit { transform: scale(0.95); opacity: 0; }
Equivalente SwiftUI:
// RUIM
.scaleEffect(visible ? 1.0 : 0.0)
// BOM
.scaleEffect(visible ? 1.0 : 0.95)
.opacity(visible ? 1.0 : 0.0)
Equivalente Compose:
// RUIM
Modifier.graphicsLayer { scaleX = if (visible) 1f else 0f; scaleY = if (visible) 1f else 0f }
// BOM
Modifier.graphicsLayer {
scaleX = if (visible) 1f else 0.95f
scaleY = if (visible) 1f else 0.95f
alpha = if (visible) 1f else 0f
}
3. Nunca usar ease-in em uma entrada
Ease-in = início lento. Um elemento que hesita ao entrar parece quebrado.
/* RUIM */
.card-enter { animation: fadeIn 0.3s ease-in; }
/* BOM */
.card-enter { animation: fadeIn 0.3s ease-out; }
/* OU spring via JS para sensação natural */
4. Nunca exceder 500ms em uma interação UI
Modais, dropdowns, tooltips, abas — usuários estão esperando. Respeite o tempo deles.
// RUIM
gsap.to(modal, { opacity: 1, y: 0, duration: 0.8 });
// BOM
gsap.to(modal, { opacity: 1, y: 0, duration: 0.25, ease: "power2.out" });
SwiftUI:
// RUIM
.animation(.easeInOut(duration: 0.8), value: state)
// BOM
.animation(.spring(response: 0.25, dampingFraction: 0.85), value: state)
Compose:
// RUIM
animateContentSize(animationSpec = tween(800))
// BOM
animateContentSize(animationSpec = spring(stiffness = Spring.StiffnessMediumLow))
5. Nunca ignorar prefers-reduced-motion
Isso é um requisito de acessibilidade, não um diferencial.
// RUIM
gsap.from('.hero-title', { opacity: 0, y: 40, duration: 0.6 });
// BOM
const prefersReduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!prefersReduced) {
gsap.from('.hero-title', { opacity: 0, y: 40, duration: 0.6 });
}
Veja a seção Movimento Reduzido multiplataforma acima para equivalentes SwiftUI / Compose.
Checklist de Performance
- Animar apenas
transformeopacity(propriedades somente de composição) - Usar
will-changecom moderação e removê-lo após a animação terminar - Preferir
requestAnimationFrameasetTimeout/setIntervalpara animações JS - Para acionadas por scroll: CSS
animation-timeline> JSIntersectionObserver> listeners de scroll - Testar em dispositivos de baixo custo (acelerar CPU 4x no DevTools)
Referência Rápida: Carregar Sub-skills
| Necessidade | Carregar |
|---|---|
| Aprofundamento em easing, configurações de spring | references/easing-guide.md |
| Padrões copiáveis de entrada/saída | references/enter-exit-recipes.md |
| Escolha de estilo ponderada por designer | references/designers.md |
| Contexto UX móvel | ../mobile-principles/SKILL.md |
| Contexto UX desktop | ../desktop-principles/SKILL.md |
| Especificidades do GSAP | ../gsap/SKILL.md |
| Especificidades do Framer Motion | ../framer-motion/SKILL.md |
| Animações apenas com CSS | ../css-native/SKILL.md |
| Three.js / R3F | ../threejs-r3f/SKILL.md |
| Canvas / generativo | ../canvas-generative/SKILL.md |
| Animações Android com Compose | ../compose-motion/SKILL.md |
| Compose Multiplatform | ../compose-multiplatform/SKILL.md |
| Animações SwiftUI iOS/macOS | ../swiftui-motion/SKILL.md |
| Gráficos avançados com Compose | ../compose-graphics/SKILL.md |
| Gráficos avançados com SwiftUI | ../swiftui-graphics/SKILL.md |
| Auditoria visual / motion / a11y | ../design-audit/SKILL.md |
| Inteligência UI/UX (84 estilos, 192 paletas) | ../ui-ux-pro-max/SKILL.md |