December 2018
Intermediate to advanced
416 pages
10h 30m
English
We want a simple function that determines if an image has panned far enough for it to count as an exit of that image:
private bool CheckForExitCriteria(){ var halfScreenWidth = _screenWidth / 2; var decisionBreakpoint = DeadZone * halfScreenWidth; return (Math.Abs(photo.TranslationX) > decisionBreakpoint); }
This function calculates whether we have passed over the dead zone and into the decision zone. We need to use the Math.Abs() method to get the total absolute value to compare it against. We could have used a < and > operator as well, but we are using this approach as it is more readable. ...
Read now
Unlock full access