Communitygithub.com

Grundlagen der Animation (Motion Foundations)

Bewegungs-Token, Feder-Voreinstellungen, Leistungsregeln, Geräteanpassung, Barrierefreiheit und SSR-Sicherheit für React / Next.js mit motion/react. Grundlegende Ebene – alle anderen Bewegungs-Skills bauen darauf auf.

Was ist Grundlagen der Animation (Motion Foundations)?

Dieser Skill definiert die grundlegende Konfigurationsebene für Animationen mit motion/react in React- und Next.js-Anwendungen. Er stellt ein zentrales Token-System für Dauer, Easing, Distanz und Skalierung bereit, ergänzt durch fünf benannte Feder-Voreinstellungen (snappy, gentle, bouncy, instant, release). Ein besonderer Fokus liegt auf Barrierefreiheit und Leistung: Die `shouldAnimate()`-Funktion respektiert `prefers-reduced-motion`, erkennt Geräte mit niedriger Leistung und deaktiviert nicht-essentielle Animationen automatisch. Außerdem gewährleistet der Skill SSR-Sicherheit, indem initiale Zustände stets mit der Serverausgabe übereinstimmen müssen, um Hydrierungsfehler zu vermeiden. Alle Werte stammen aus den zentralen Token-Objekten; direkte Definitionen in Komponenten sind verboten. Der Skill setzt klare Regeln durch, wie das ausschließliche Verwenden von `motion/react` (nie `framer-motion`), das Animieren nur mit `transform` und `opacity` (nie Layout-Eigenschaften) sowie die zwingende `"use client"`-Direktive in Dateien, die motion/react importieren. Er dient als Grundlage für aufbauende Skills wie `motion-patterns` und `motion-advanced` und wird vor jeder Animationsarbeit aktiviert.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Cody-W-Tucker/skills/tree/HEAD/skills/motion-foundations

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht Grundlagen der Animation (Motion Foundations)?

Die Basisschicht des Animationssystems. Definiert jeden Wert, jede Einschränkung und jede Regel, die von nachgelagerten Skills (motion-patterns, motion-advanced) übernommen werden. Lade diesen Skill, bevor du mit der Animationsarbeit beginnst.

Wann aktivieren

  • Erstellen einer animierten Komponente von Grund auf
  • Einrichten von Token, Feder-Voreinstellungen oder Easing-Werten
  • Implementieren der prefers-reduced-motion-Unterstützung
  • Beheben von Hydrierungskonflikten durch initiale Animationszustände
  • Prüfen, ob eine Animation überhaupt existieren sollte

Ergebnisse

Dieser Skill produziert:

  • Ein gemeinsames motionTokens-Objekt (Dauer, Easing, Distanz, Skalierung)
  • Eine gemeinsame springs-Voreinstellungsliste (5 benannte Konfigurationen)
  • Ein shouldAnimate()-Gate, das von allen Komponenten verwendet wird
  • Barrierefreie Animationsvorgaben mittels useReducedMotion
  • SSR-sichere Anfangszustände ohne Hydrierungswarnungen

Prinzipien

Animation muss mindestens eines der folgenden Ziele erfüllen, sonst muss sie entfernt werden:

  • Aufmerksamkeit lenken
  • Zustand kommunizieren
  • Räumliche Kontinuität bewahren

Reaktionsfähigkeit hat immer Vorrang vor flüssiger Darstellung. Eine Animation mit 60 fps, die Eingabeverzögerungen verursacht, ist schlechter als keine Animation.

Regeln

Diese sind nicht verhandelbar. Sie gelten für jede Komponente im System.

  1. Nur motion/react verwenden. Niemals von framer-motion importieren. Niemals beide im selben Baum mischen.
  2. initial muss mit der Serverausgabe übereinstimmen. Wenn der Server opacity: 1 rendert, muss die initial-Eigenschaft ebenfalls opacity: 1 sein. Keine Ausnahmen.
  3. Reduzierte Bewegung überschreibt alles. Wenn useReducedMotion() true zurückgibt oder prefersReduced true ist, werden alle Transformationen deaktiviert. Nur Durchsichtigkeits-Überblendungen mit ≤ 0,2 s sind als Fallback erlaubt.
  4. Niemals Layout-Eigenschaften animieren. width, height, top, left, margin, padding sind in animate verboten. Nur transform und opacity verwenden.
  5. Alle Token-Werte stammen aus motionTokens. Fest codierte Dauern und Easings in Komponentendateien sind verboten.
  6. Alle Feder-Konfigurationen stammen aus der springs-Liste. Inline-stiffness-/damping-Werte sind verboten.
  7. "use client" ist erforderlich in jeder Datei, die von motion/react importiert.
  8. Niemals window oder navigator auf Modulebene lesen. Immer mit typeof window !== "undefined" absichern.

Entscheidungshilfe

Dauer wählen

TokenVerwende, wenn
instantTooltip ein-/ausblenden, Fokusring, Badge-Update
fastButton-Feedback, Icon-Wechsel, Chip-Umschalten
normalModal öffnen, Karte erweitern, Seitenelement eintreten
slowHero-Eingang, seitenfüllender Übergang
crawlBewusstes Storytelling; sparsam verwenden

Feder wählen

VoreinstellungVerwende, wenn
snappyStandard-UI — Buttons, Chips, Nav-Elemente
gentleKarten, Modale, Panels sanft ablegen
bouncyVerspielte Momente — leere Zustände, Onboarding
instantTooltips, Popover, Dropdowns
releaseZiehen loslassen — natürliches Physikgefühl

Wann Animation komplett deaktivieren

Deaktiviere (lasse shouldAnimate() false zurückgeben), wenn:

  • prefersReduced true ist
  • isLowEnd true ist und die Animation nicht wesentlich ist
  • Das Element außerhalb des Bildschirms ist und niemals in den Viewport gelangt
  • Die Animation rein dekorativ ist und keinen UX-Zweck erfüllt

Kernkonzepte

Token-System

// lib/motion-tokens.ts
export const motionTokens = {
  duration: {
    instant: 0.08,
    fast:    0.18,
    normal:  0.35,
    slow:    0.6,
    crawl:   1.0,
  },
  easing: {
    smooth: [0.22, 1, 0.36, 1],
    sharp:  [0.4, 0, 0.2, 1],
    bounce: [0.34, 1.56, 0.64, 1],
    linear: [0, 0, 1, 1],
  },
  distance: {
    xs: 4,
    sm: 8,
    md: 16,
    lg: 24,
    xl: 48,
  },
  scale: {
    subtle: 0.98,
    press:  0.95,
    pop:    1.04,
  },
}

export const springs = {
  snappy:  { type: "spring", stiffness: 300, damping: 30 },
  gentle:  { type: "spring", stiffness: 120, damping: 14 },
  bouncy:  { type: "spring", stiffness: 400, damping: 10 },
  instant: { type: "spring", stiffness: 600, damping: 35 },
  release: { type: "spring", stiffness: 200, damping: 20, restDelta: 0.001 },
}

Laufzeit-Flags

// lib/motion-config.ts
export const motionConfig = {
  isLowEnd() {
    return (
      typeof navigator !== "undefined" &&
      navigator.hardwareConcurrency <= 4
    )
  },

  prefersReduced() {
    return (
      typeof window !== "undefined" &&
      window.matchMedia("(prefers-reduced-motion: reduce)").matches
    )
  },

  shouldAnimate({ essential = false } = {}) {
    if (this.prefersReduced()) return false
    if (!essential && this.isLowEnd()) return false
    return true
  },

  duration() {
    return this.isLowEnd() || this.prefersReduced()
      ? motionTokens.duration.instant
      : motionTokens.duration.normal
  },
}

Barrierefreiheit

Prioritätsreihenfolge (höchste zu niedrigste):

  1. prefers-reduced-motion: reduce — deaktiviert alle Transformationen, begrenzt Durchsichtigkeits-Übergänge auf ≤ 0,2 s
  2. Erkennung von Geräten mit niedriger Leistung — reduziert die Dauer, entfernt nicht-essentielle Animationen
  3. Designpräferenz — alles andere

Animation muss sich elegant degradieren lassen. Sie darf niemals abrupt verschwinden und dabei Layout-Verschiebungen verursachen oder die Orientierung verwirren.

// hooks/use-reduced-motion.tsx
"use client"
import { useReducedMotion } from "motion/react"

export function useSafeMotion(fullY: number = 16) {
  const reduce = useReducedMotion()
  return {
    initial: { opacity: 0, y: reduce ? 0 : fullY },
    animate: { opacity: 1, y: 0 },
    exit:    { opacity: 0, y: reduce ? 0 : -fullY },
  }
}
/* globals.css */
@media (prefers-reduced-motion: reduce) {
  .motion-safe-transition  { transition: opacity 0.15s; }
  .motion-reduce-transform { transform: none !important; }
}
<!-- Tailwind -->
<div class="motion-safe:animate-fade motion-reduce:opacity-100"></div>

SSR / Hydrierungssicherheit

Regel: initial muss immer mit dem übereinstimmen, was der Server rendert.

// FALSCH — Server rendert opacity:1, aber initial sagt 0 → Hydrierungskonflikt
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} />

// RICHTIG — AnimatePresence verwenden oder auf Client-Mount verschieben
"use client"
const [mounted, setMounted] = useState(false)
useEffect(() => setMounted(true), [])

<motion.div
  initial={{ opacity: mounted ? 0 : 1 }}
  animate={{ opacity: 1 }}
/>

Codebeispiele

End-to-End: Token + Federn + Barrierefreiheit + SSR-Schutz

// components/fade-in-card.tsx
"use client"

import { useState, useEffect } from "react"
import { motion } from "motion/react"
import { motionTokens, springs } from "@/lib/motion-tokens"
import { useSafeMotion } from "@/hooks/use-reduced-motion"
import { motionConfig } from "@/lib/motion-config"

interface FadeInCardProps {
  children: React.ReactNode
  delay?: number
}

export function FadeInCard({ children, delay = 0 }: FadeInCardProps) {
  // SSR-Schutz — initial muss der Serverausgabe entsprechen (opacity: 1)
  const [mounted, setMounted] = useState(false)
  useEffect(() => setMounted(true), [])

  // Barrierefreiheit — deaktiviert Transformationen bei reduzierter Bewegung
  const safeMotion = useSafeMotion(motionTokens.distance.md)

  // Geräteprüfung — Animation auf schwacher Hardware überspringen
  if (!motionConfig.shouldAnimate() || !mounted) {
    return <div>{children}</div>
  }

  return (
    <motion.div
      initial={safeMotion.initial}
      animate={safeMotion.animate}
      exit={safeMotion.exit}
      transition={{
        ...springs.gentle,
        delay,
      }}
      whileHover={{ scale: motionTokens.scale.pop }}
      whileTap={{ scale: motionTokens.scale.press }}
    >
      {children}
    </motion.div>
  )
}

Einschränkungen / Nicht-Ziele

Dieser Skill deckt nicht ab:

  • UI-Komponenten-Muster (Button, Modal, Staffelung) → siehe motion-patterns
  • Drag, Gesten, SVG, Textanimationen, eigene Hooks → siehe motion-advanced
  • CSS-only-Animationen oder Tailwind animate-*-Klassen ohne motion/react
  • Animationsbibliotheken von Drittanbietern (GSAP, anime.js, etc.)
  • Motion-Design-Entscheidungen (wann animieren, was hervorheben) — das ist eine Designfrage, keine Codeeinschränkung

Anti-Patterns

Anti-PatternVerstoß gegen RegelKorrektur
import { motion } from "framer-motion"Regel 1motion/react verwenden
initial={{ opacity: 0 }} bei SSR-KomponenteRegel 2Mount-Schutz hinzufügen
useReducedMotion-Prüfung überspringenRegel 3useSafeMotion-Hook verwenden
animate={{ width: "100%" }}Regel 4scaleX-Transformation stattdessen verwenden
transition={{ duration: 0.4 }} inlineRegel 5motionTokens.duration.normal verwenden
{ stiffness: 300, damping: 30 } inlineRegel 6springs.snappy verwenden
Fehlende "use client"-DirektiveRegel 7Oben in der Datei hinzufügen
navigator.hardwareConcurrency auf ModulebeneRegel 8In typeof navigator !== "undefined" einbetten

Verwandte Skills

  • motion-patterns — verwendet die hier definierten Token und Federn, um Button-, Modal-, Staffelungs-, Seitenübergangs- und Scroll-Muster zu erstellen. Definiert keine Werte neu.
  • motion-advanced — verwendet die hier definierten Token und Federn für Drag-, SVG-, Text- und Gestenmuster. Fügt useAnimate-Sequenzen und benutzerdefinierte Hooks auf dieser Grundlage hinzu.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Cody-W-Tucker/skills

Landing page quality assessment for paid advertising campaigns. Evaluates message match, page speed, mobile experience, trust signals, form optimization, and conversion rate potential. Use when user says landing page, post-click experience, landing page audit, conversion rate, or landing page optimization.

Cody-W-Tucker/skills

TikTok Ads deep analysis covering creative quality, tracking, bidding, campaign structure, and TikTok Shop. Evaluates 28 checks with emphasis on creative-first strategy, safe zone compliance, and Smart+ campaigns. Use when user says TikTok Ads, TikTok marketing, TikTok Shop, Spark Ads, Smart+, or TikTok campaign.

Cody-W-Tucker/skills

YouTube Ads specific analysis covering campaign types, creative quality, audience targeting, and measurement. Evaluates video ad performance across skippable, non-skippable, bumper, Shorts, Demand Gen, and Connected TV formats. Covers VAC→Demand Gen migration, Shorts creative requirements, and CTV shoppable ads. Use when user says YouTube Ads, video ads, pre-roll, bumper ads, YouTube campaign, Shorts ads, or CTV ads.

Cody-W-Tucker/skills

Craft the story that makes investors say \"I want in.\" Master the narrative structure that Reid Hoffman, Sequoia, and top founders use to raise capital. Use when: **Preparing to fundraise** to develop your story before the deck; **Investor meetings** to structure conversations that convert; **Pitch practice** to refine your narrative arc; **Cold outreach** to write compelling investor emails; **Pivoting** to reframe your story after a change

Cody-W-Tucker/skills

Identify the best GTM motions and tools across 7 motion types: Inbound, Outbound, Paid Digital, Community, Partners, ABM, and PLG. Use when selecting marketing channels, choosing between inbound and outbound strategy, or planning cross-channel campaigns.

Cody-W-Tucker/skills

Produce a print-grade single-page kami (紙 / 纸) document — warm parchment canvas, ink-blue accent, serif at one weight, no italic, no cool grays. The output reads like a professional white paper or studio one-pager, not an app UI. Multilingual by design (EN · zh-CN · ja). One self-contained HTML file, zero dependencies.

Cody-W-Tucker/skills

Optimize landing pages for maximum conversions using proven frameworks from Unbounce and Oli Gardner—apply the \"one goal, one message, one action\" principle with data-driven design, copy, and CTA best practices. Use when: **Create a new landing page** for a campaign; **Optimize an existing landing page** that isn't converting; **Review landing page design** before launch; **Improve form conversion rates** on lead gen pages; **A/B test landing page elements** systematically

Cody-W-Tucker/skills

Advanced motion patterns for React / Next.js — drag & drop, gestures, text animations, SVG path drawing, custom hooks, imperative sequences (useAnimate), loaders, and the full API decision tree. Requires motion-foundations.

Cody-W-Tucker/skills

A single-frame motion-design composition with looping CSS animations — rotating type ring, animated globe, ticking timer, parallax labels. Renders as a hero video poster you can hand straight to HyperFrames or any keyframe-based exporter. Use when the brief asks for "motion design", "animated hero", "loop", "video poster", "title card", or pairs Open Claude Design with HyperFrames for a kinetic export.

Cody-W-Tucker/skills

Production-ready animation patterns for React / Next.js — button, modal, toast, stagger, page transitions, exit animations, scroll, and layout — built on motion-foundations tokens and springs.

Cody-W-Tucker/skills

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

Cody-W-Tucker/skills

Produce a single-file slide deck in the Atelier Zero visual language (warm-paper background, italic-serif emphasis spans, coral terminating dots, surreal collage plates) — Open Design's brand deck recipe. The deck uses **horizontal magazine-style swipe pagination** (←/→, wheel, swipe), a per-slide chrome strip with brand mark and slide counter, an ESC overview grid, a coral progress bar, and inherits the canonical stylesheet + 16-slot image library from the sister `open-design-landing` skill.

Cody-W-Tucker/skills

Produce a world-class single-page editorial landing site in the Atelier Zero visual language (Monocle / Apartamento / Études editorial collage) — the same aesthetic Open Design uses for its own marketing surface. The agent fills a typed `inputs.json` from a brand brief, optionally generates 16 collage assets via gpt-image-2, then runs a pure-function composer that emits a self-contained HTML file; a separate path can mirror the Astro marketing site in `apps/landing-page/`. Drop-in scroll-reveal motion and a Headroom-style sticky nav are wired automatically.

Cody-W-Tucker/skills

Best practices for Remotion - Video creation in React. 29 domain-specific rules covering 3D, animations, audio, captions, charts, transitions, and more.

Cody-W-Tucker/skills

Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens. Trigger keywords: "saas landing", "marketing page", "product landing".

Cody-W-Tucker/skills

Single-page SaaS landing with hero, features, social proof, pricing, and CTA. Respects the active DESIGN.md color/typography/layout tokens. Trigger keywords: "saas landing", "marketing page", "product landing".

Cody-W-Tucker/skills

Master April Dunford's 8-step sales narrative from \"Sales Pitch\" (2023). Transform your positioning into a compelling story that wins enterprise deals. Use when: Structuring B2B sales presentations and demos; Creating pitch decks for complex products; Training sales teams on narrative-driven selling; Converting positioning strategy into sales conversations; Winning against entrenched competitors

Cody-W-Tucker/skills

Swiss-style user-research narrative template in warm-paper editorial aesthetics. Use when users ask for a premium research deck or story-first live artifact with minimalist typography, high-clarity layout, subtle motion, donut breakdowns, and keyboard/click navigation across slides in a single HTML file.

Cody-W-Tucker/skills

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

Cody-W-Tucker/skills

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

Verwandte Skills