Skip to content

Instantly share code, notes, and snippets.

@didacus
Created May 16, 2019 07:58
Show Gist options
  • Save didacus/05f47d96d1430e86518b829318be5dc6 to your computer and use it in GitHub Desktop.
Save didacus/05f47d96d1430e86518b829318be5dc6 to your computer and use it in GitHub Desktop.
Framer X — Parallax
import { Override, motionValue, useTransform } from "framer"
const contentOffsetY = motionValue(0)
// Apply this override to your scroll component
export function TrackScroll(): Override {
return { contentOffsetY: contentOffsetY }
}
// Apply this override to your parallax layer
export function ParallaxLayer(): Override {
const y = useTransform(contentOffsetY, [0, -100], [0, 50], {
clamp: false,
})
return {
y: y,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment