SHARE
TWEET

Untitled

a guest Sep 19th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Override, motionValue, useTransform } from "framer"
  2.  
  3. // Create a MotionValue to track scroll content offset
  4. const contentOffsetY = motionValue(0) // How much how we scrolled up a
  5.  
  6.  
  7. export function TrackScroll(): Override {
  8.     return {
  9.         contentOffsetY: contentOffsetY,
  10.         onScroll() {
  11.             console.log(contentOffsetY)
  12.         },
  13.     }
  14. }
  15.  
  16. // Apply this override to your header component
  17. export function ScrollHorizontal(): Override {
  18.     // const x = useTransform(contentOffsetY, value => value)
  19.     const contentOffsetX = useTransform(contentOffsetY, value => value)
  20.  
  21.     return {
  22.         contentOffsetX: contentOffsetX,
  23.         onScroll() {
  24.             console.log("Scrolling")
  25.         },
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top