Optimized for: Gemini / ChatGPT / Claude
Expert AI Prompt for Scroll-Linked SVG Path Drawing in React
Use this engineered prompt to drastically optimize your workflow and output.
Required Variables
- ✦
[SVG_PATH_DATA] - ✦
[STRIKE_COLOR] - ✦
[DRAW_DIRECTION] - ✦
[OFFSET_START]
scroll-linked-svg-path-drawing-framer-motion.txt
You are a creative technologist. Develop a React component that uses Framer Motion to animate an SVG path drawing effect linked directly to the user's scroll position. Use [SVG_PATH_DATA] as the target shape. Map the pathLength property of the motion.path element to the scroll progress using useTransform. The animation should begin at [OFFSET_START] of the viewport and complete at the end of the container. Use [STRIKE_COLOR] for the stroke. Ensure the path is responsive and recalculates its length on window resize using a custom hook. Integrate Intersection Observer to ensure the animation only runs when the SVG is in view to save GPU resources.
Example Output
"The AI will provide a React component that dynamically renders an SVG where the stroke-dasharray and stroke-dashoffset are controlled by the scroll position, creating a 'drawing' effect as the user moves down the page."