Loading...
Loading...
Official Framer Motion skill for scroll-linked animations — useScroll, useTransform, scroll-triggered animations, parallax. Use when building scroll-driven animations, parallax effects, progress indicators, or when asking about Framer Motion scroll, useScroll, or scroll-linked animations.
npx skill4agent add c-jeril/framer-motion-skills framer-motion-scrolluseScrolluseTransformuseScrollimport { useScroll, useTransform } from "framer-motion";
function Component() {
const { scrollYProgress } = useScroll();
return (
<motion.div
style={{ scaleX: scrollYProgress }}
/>
);
}const { scrollYProgress } = useScroll({
target: ref,
offset: ["start end", "end start"],
container: containerRef
});"start end"startcenterend| Combination | Meaning |
|---|---|
| While element visible |
| While scrolling down |
| Entire document scroll |
const { scrollYProgress } = useScroll();
const scale = useTransform(scrollYProgress, [0, 1], [1, 2]);
const opacity = useTransform(scrollYProgress, [0, 0.5, 1], [0, 1, 0]);
return <motion.div style={{ scale, opacity }} />;const x = useTransform(
scrollYProgress,
[0, 0.3, 0.6, 1],
[0, -50, 50, 0]
);const x = useTransform(
scrollYProgress,
[0, 1],
[0, 100],
{ clamp: false }
);function ParallaxSection() {
const { scrollYProgress } = useScroll({
target: ref,
offset: ["start end", "end start"]
});
const y = useTransform(scrollYProgress, [0, 1], [100, -100]);
return (
<motion.div ref={ref} style={{ y }}>
Parallax Content
</motion.div>
);
}function ScrollProgress() {
const { scrollYProgress } = useScroll();
return (
<motion.div
style={{
scaleX: scrollYProgress,
position: "fixed",
top: 0,
left: 0,
right: 0,
height: 4,
backgroundColor: "#00ff00",
transformOrigin: "0%"
}}
/>
);
}import { useInView, motion } from "framer-motion";
import { useRef } from "react";
function FadeInSection() {
const ref = useRef(null);
const isInView = useInView(ref, { once: true, margin: "-100px" });
return (
<motion.div
ref={ref}
initial={{ opacity: 0, y: 50 }}
animate={isInView ? { opacity: 1, y: 0 } : { opacity: 0, y: 50 }}
transition={{ duration: 0.6 }}
>
Content
</motion.div>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
| once | | | Only trigger once |
| margin | | | Offset for trigger |
| amount | | | Visibility threshold |
transformOriginuseInViewonce: true