Skip to content

Instantly share code, notes, and snippets.

@lintonye
Created March 24, 2020 17:37
Show Gist options
  • Save lintonye/44d38acbdf96791e6e707b983cf8fed7 to your computer and use it in GitHub Desktop.
Save lintonye/44d38acbdf96791e6e707b983cf8fed7 to your computer and use it in GitHub Desktop.
import * as React from "react"
import { Override, Data, transform } from "framer"
import {
useScroll,
useTrackScrollY,
// @ts-ignore
} from "@framer/lintonye.parallax/code"
const appState = Data({
percentage: 0,
})
export function Lottie(): Override {
const { scrollY } = useScroll()
useTrackScrollY(y => {
appState.percentage = transform(y, [0, -200], [0, 100])
})
return {
percentage: appState.percentage,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment