Created
October 24, 2022 19:05
-
-
Save m5kr1pka/f02c2afcaf5c73cc38546a801c48368a to your computer and use it in GitHub Desktop.
canvas-scroll-clip React component example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import CanvasScrollClip from "canvas-scroll-clip"; | |
const CanvasScroll = ({ firstFrame, frameCount, frameScrollArea }) => { | |
const ref = React.createRef(); | |
React.useEffect(() => { | |
new CanvasScrollClip(ref.current, { | |
framePath: firstFrame, | |
frameCount: frameCount, | |
scrollArea: frameScrollArea | |
}); | |
}, []); | |
return ( | |
<div ref={ref}></div> | |
) | |
} | |
export default CanvasScroll; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: