Skip to content

Instantly share code, notes, and snippets.

@ruucm-working
Created May 22, 2019 16:39
Show Gist options
  • Select an option

  • Save ruucm-working/54717ec871a36bba8bd627b9f98a5c06 to your computer and use it in GitHub Desktop.

Select an option

Save ruucm-working/54717ec871a36bba8bd627b9f98a5c06 to your computer and use it in GitHub Desktop.
--- a/adidas-landing.framerfx/code/App.tsx
+++ b/adidas-landing.framerfx/code/App.tsx
@@ -8,6 +8,27 @@ export function Scroll(): Override {
async onScroll(e) {
var move = e.point.y
log('move', move)
+
+ if (showHeader && move < -50) {
+ showHeader = false
+ headerAnim.start({
+ top: -100,
+ })
+ } else if (showHeader == false && move > -40) {
+ showHeader = true
+ await headerAnim.start({
+ top: 0,
+ })
+ }
},
}
}
+
+var headerAnim
+var showHeader = true
+export function Header(): Override {
+ headerAnim = useAnimation()
+ return {
+ animate: headerAnim,
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment