Skip to content

Instantly share code, notes, and snippets.

@rgommezz
Last active August 6, 2018 18:05
Show Gist options
  • Save rgommezz/4149df895933cf963dcb41ce55d254ea to your computer and use it in GitHub Desktop.
Save rgommezz/4149df895933cf963dcb41ce55d254ea to your computer and use it in GitHub Desktop.
Let's assume our navigation bar has a height of 80, so it's driven by diffClamp(0, 80)
The position of the navigation bar is dictated by the inverse of that operation.
navBarTranslateY = multiply(diffClamp(0, 80), -1);
# Scenario 1
scrollY | navBarY | snapAmount
0 | 0 |
20 | -20 |
30 | -30 |
Release | * | 30
* | 0 |
30 | -30 | <- We scroll again. NavBar position changes abruptly from 0 to -30
50 | -50 |
# Scenario 2
scrollY | navBarY | snapAmount
0 | 0 |
80 | -80 |
60 | -60 |
Release | * | -20
* | -80 |
60 | -60 | <- We scroll again. NavBar position changes abruptly from -80 to -60
0 | 0 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment