secondsky/claude-skills / plugins/motion/skills/motion
motion
VerifiedMotion (Framer Motion) React animation library. Use for drag-and-drop, scroll animations, gestures, SVG morphing, or encountering bundle size, complex transitions, spring physics errors.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.9 KB |
| references/accessibility-guide.md | markdown | 15.8 KB |
| references/common-patterns.md | markdown | 4.0 KB |
| references/core-concepts-deep-dive.md | markdown | 14.8 KB |
| references/motion-vs-auto-animate.md | markdown | 16.0 KB |
| references/nextjs-integration.md | markdown | 15.4 KB |
| references/performance-optimization.md | markdown | 18.6 KB |
| scripts/init-motion.shexecutable | script | 5.7 KB |
| scripts/optimize-bundle.shexecutable | script | 4.8 KB |
| templates/layout-transitions.tsx | other | 17.6 KB |
| templates/motion-nextjs-client.tsx | other | 12.6 KB |
| templates/motion-vite-basic.tsx | other | 9.1 KB |
| templates/scroll-parallax.tsx | other | 14.6 KB |
| templates/ui-components.tsx | other | 19.6 KB |
scripts/init-motion.sh
View on GitHub#!/bin/bash
# Motion Setup Script
# Automates installation and initial setup for React + Vite + Next.js projects
set -e
echo "π¬ Motion Setup"
echo "==============="
echo ""
# Check if package.json exists
if [ ! -f "package.json" ]; then
echo "β Error: package.json not found"
echo " Run this script from your project root"
exit 1
fi
# Detect framework
FRAMEWORK="unknown"
USING_NEXTJS=false
USING_VITE=false
USING_CLOUDFLARE=false
if grep -q '"next"' package.json; then
FRAMEWORK="Next.js"
USING_NEXTJS=true
echo "β
Detected: Next.js project"
elif grep -q '"vite"' package.json; then
FRAMEWORK="Vite"
USING_VITE=true
echo "β
Detected: Vite project"
else
echo "β οΈ Could not detect framework (Next.js or Vite)"
echo " Will proceed with generic setup"
fi
# Check for Cloudflare Workers
if grep -q '@cloudflare/vite-plugin\|wrangler' package.json; then
USING_CLOUDFLARE=true
echo "π Detected: Cloudflare Workers project"
echo ""
echo "β οΈ WARNING: Motion has build compatibility issues with Wrangler"
echo " Recommendation: Use framer-motion v12.43.0 instead"
echo ""
read -p "Continue with Motion (may cause build errors) or use framer-motion? [motion/framer]: " choice
if [ "$choice" = "framer" ]; then
PACKAGE="framer-motion"
else
PACKAGE="motion"
fi
else
PACKAGE="motion"
fi
echo ""
# Detect package manager
if command -v pnpm &> /dev/null; then
PKG_MANAGER="pnpm"
elif command -v yarn &> /dev/null; then
PKG_MANAGER="yarn"
else
PKG_MANAGER="npm"
fi
# Install Motion
echo "π¦ Installing $PACKAGE using $PKG_MANAGER..."
if [ "$PKG_MANAGER" = "pnpm" ]; then
pnpm add $PACKAGE
elif [ "$PKG_MANAGER" = "yarn" ]; then
yarn add $PACKAGE
else
npm install $PACKAGE
fi
echo "β
Package installed"
echo ""
# Create directories
mkdir -p src/components
mkdir -p src/hooks
# Next.js specific setup
if [ "$USING_NEXTJS" = true ]; then
echo "π Creating Next.js App Router Client Component wrapper..."
# Create motion-client.tsx wrapper
cat > src/components/motion-client.tsx << 'EOF'
"use client"
// Optimized import for Next.js (reduces client JS bundle)
import * as motion from "motion/react-client"
export { motion }
// Also export commonly used components
export {
AnimatePresence,
MotionConfig,
LazyMotion,
LayoutGroup,
useMotionValue,
useTransform,
useScroll,
useSpring,
useAnimate,
useInView,
useDragControls,
} from "motion/react-client"
EOF
echo "β
Created: src/components/motion-client.tsx"
echo ""
# Create MotionProvider
cat > src/components/MotionProvider.tsx << 'EOF'
"use client"
import { MotionConfig } from "motion/react-client"
import { ReactNode } from "react"
export function MotionProvider({ children }: { children: ReactNode }) {
return (
<MotionConfig reducedMotion="user">
{children}
</MotionConfig>
)
}
EOF
echo "β
Created: src/components/MotionProvider.tsx"
echo ""
# Create example component
cat > src/components/AnimatedButton.tsx << 'EOF'
"use client"
import { motion } from "motion/react-client"
export function AnimatedButton() {
return (
<motion.button
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.95 }}
className="px-6 py-3 bg-blue-600 text-white rounded-lg font-semibold"
>
Hover and Click Me
</motion.button>
)
}
EOF
echo "β
Created: src/components/AnimatedButton.tsx"
echo ""
fi
# Vite specific setup
if [ "$USING_VITE" = true ]; then
echo "π Creating Vite example component..."
cat > src/components/AnimatedExample.tsx << 'EOF'
import { motion } from "motion/react"
export function AnimatedExample() {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
className="p-6 bg-blue-100 rounded-lg"
>
<h2 className="text-xl font-bold">Motion Animation</h2>
<p>This component fades in and slides up on mount.</p>
</motion.div>
)
}
EOF
echo "β
Created: src/components/AnimatedExample.tsx"
echo ""
fi
# Summary
echo "β¨ Setup complete!"
echo ""
echo "Next steps:"
echo ""
if [ "$USING_NEXTJS" = true ]; then
echo "1. Add MotionProvider to your root layout:"
echo " // src/app/layout.tsx"
echo " import { MotionProvider } from '@/components/MotionProvider'"
echo " "
echo " export default function RootLayout({ children }) {"
echo " return ("
echo " <html>"
echo " <body>"
echo " <MotionProvider>"
echo " {children}"
echo " </MotionProvider>"
echo " </body>"
echo " </html>"
echo " )"
echo " }"
echo ""
echo "2. Use Motion in any component:"
echo " import { motion } from '@/components/motion-client'"
echo " "
echo " <motion.div animate={{ opacity: 1 }}>Content</motion.div>"
echo ""
echo "3. See example:"
echo " import { AnimatedButton } from '@/components/AnimatedButton'"
echo ""
elif [ "$USING_VITE" = true ]; then
echo "1. Import the example component:"
echo " import { AnimatedExample } from '@/components/AnimatedExample'"
echo ""
echo "2. Use it in your app:"
echo " <AnimatedExample />"
echo ""
fi
echo "4. Check templates/ folder for more examples:"
echo " - Modal dialogs"
echo " - Accordions"
echo " - Carousels"
echo " - Scroll animations"
echo " - Layout transitions"
echo ""
if [ "$USING_CLOUDFLARE" = true ]; then
echo "β οΈ IMPORTANT (Cloudflare Workers):"
echo " Monitor GitHub issue #2918 for Motion + Wrangler compatibility"
echo " Consider using framer-motion v12.43.0 if build errors occur"
echo ""
fi
echo "π Documentation:"
echo " - Official: https://motion.dev/docs/react"
echo " - Skill docs: ../SKILL.md"
echo ""
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |