Skip to content

Instantly share code, notes, and snippets.

@larssondaniel
Created April 2, 2017 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larssondaniel/40e371e7d8ceb9528377c1bca3bf0d9a to your computer and use it in GitHub Desktop.
Save larssondaniel/40e371e7d8ceb9528377c1bca3bf0d9a to your computer and use it in GitHub Desktop.
- (void)panningChangedWithTranslation:(CGPoint)translation
{
if (self.playerViewAnimator.isRunning)
{
return;
}
CGFloat translatedY = self.view.center.y + translation.y;
CGFloat progress;
switch (self.playerState) {
case PlayerStateThumbnail:
progress = 1 - (translatedY / self.view.center.y);
break;
case PlayerStateFullscreen:
progress = (translatedY / self.view.center.y) - 1;
}
progress = MAX(0.001, MIN(0.999, progress));
self.playerViewAnimator.fractionComplete = progress;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment