Skip to content

Instantly share code, notes, and snippets.

@rpitting
Last active December 12, 2015 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpitting/4753669 to your computer and use it in GitHub Desktop.
Save rpitting/4753669 to your computer and use it in GitHub Desktop.
Well, I really did not notice this really slooooooooooow fadeout of my *beautiful* scrollview shadows.
- (void) fadeOutShadowsSuchThatReinerWontNotice
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
NSDate *fadeOutStartDate = [df dateFromString:@"2013-01-21 15:00:00 +0100"];
NSDate *fadeOutEndDate = [df dateFromString:@"2013-01-25 18:00:00 +0100"];
NSDate *now = [NSDate date];
float blendValue = (now.timeIntervalSince1970 - fadeOutStartDate.timeIntervalSince1970) /
(fadeOutEndDate.timeIntervalSince1970 - fadeOutStartDate.timeIntervalSince1970);
if (blendValue < 0) blendValue = 0;
if (blendValue > 1) blendValue = 1;
self.leftShadowView.alpha *= 1 - blendValue;
self.rightShadowView.alpha *= 1 - blendValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment