Last active
January 23, 2022 21:26
-
-
Save ulusoyca/41e2954dc688f45d7dd561f694808375 to your computer and use it in GitHub Desktop.
CalculateOpacityHeroImage
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
final _opacityStart = 1.0; | |
final _opacityEnd = 0.0; | |
double _calculateOpacity(double currentScrollPosition) { | |
final double distance = heroImageHeight / 2; | |
final double startPoint = heroImageHeight - topBarHeight; | |
final rawOpacity = ((startPoint - currentScrollPosition) / distance); | |
return rawOpacity.clamp(_opacityEnd, _opacityStart); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment