Last active
January 29, 2022 19:44
-
-
Save ulusoyca/1ac7ddd5de60f2cab6df75304b938893 to your computer and use it in GitHub Desktop.
CalculateGenericPropertChange
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
double calculateTransformationValue({ | |
required double rangeInPx, | |
required double progressInRangeInPx, | |
required double startValue, | |
required double endValue, | |
}) { | |
final progress = progressInRangeInPx / rangeInPx; | |
final rawValue = startValue + (progress * (endValue - startValue)); | |
return rawValue.clamp(min(startValue, endValue), max(startValue, endValue)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment