Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions REFrostedViewController/REFrostedContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ - (void)refreshBackgroundImage
self.backgroundImageView.image = self.screenshotImage;
}

- (void)changeBackgroundViewsAlphaForPanGestureWithValue:(CGFloat)value
{
CGFloat targetValue = self.containerView.frame.size.width;
CGFloat progress = (targetValue - ABS(value)) / targetValue;
[self setBackgroundViewsAlpha:(progress * self.frostedViewController.backgroundFadeAmount)];
}

#pragma mark -
#pragma mark Gesture recognizer

Expand Down Expand Up @@ -315,6 +322,8 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
frame.size.width = self.view.frame.size.width;
}
}

[self changeBackgroundViewsAlphaForPanGestureWithValue:self.containerView.frame.origin.x];
}

if (self.frostedViewController.direction == REFrostedViewControllerDirectionRight) {
Expand All @@ -329,6 +338,8 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
frame.size.width = self.view.frame.size.width - frame.origin.x;
}
}

[self changeBackgroundViewsAlphaForPanGestureWithValue:self.containerView.frame.origin.x];
}

if (self.frostedViewController.direction == REFrostedViewControllerDirectionTop) {
Expand All @@ -342,6 +353,8 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
frame.size.height = self.view.frame.size.height;
}
}

[self changeBackgroundViewsAlphaForPanGestureWithValue:self.containerView.frame.origin.y];
}

if (self.frostedViewController.direction == REFrostedViewControllerDirectionBottom) {
Expand All @@ -356,6 +369,8 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
frame.size.height = self.view.frame.size.height - frame.origin.y;
}
}

[self changeBackgroundViewsAlphaForPanGestureWithValue:self.containerView.frame.origin.y];
}

[self setContainerFrame:frame];
Expand Down