Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug for scrollView and POP animation #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
17 changes: 12 additions & 5 deletions MSender/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ - (void)viewDidLoad {
//Add Tree & Filter
[self TreeImagenFilter];

self.view.layer.masksToBounds = YES;
self.view.layer.cornerRadius = 8;

[self addObserver:self forKeyPath:@"treeWaveProgress" options:NSKeyValueObservingOptionNew context:nil];

}
Expand Down Expand Up @@ -106,7 +109,7 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView

_LNew.alpha = 0;


[self pop_removeAllAnimations];
}

-(void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
Expand All @@ -133,8 +136,11 @@ - (void)popAnimation {
animation.springSpeed = 8;
animation.completionBlock = ^(POPAnimation *anim, BOOL finished){

[self.scview setContentOffset:CGPointMake(0, 0)];
[self pop_removeAnimationForKey:@"popAnimation"];
if (finished) {

[self.scview setContentOffset:CGPointMake(0, 0)];
[self pop_removeAnimationForKey:@"popAnimation"];
}
};
animation.property = [POPAnimatableProperty propertyWithName:@"popAnimationProgress" initializer:^(POPMutableAnimatableProperty *prop) {
prop.readBlock = ^(ViewController *obj, CGFloat values[]) {
Expand Down Expand Up @@ -209,13 +215,14 @@ - (void) parallax{
//Wave the trees when the plan fly across them:)
- (void)setTreeWave{

_treeWaveProgress = -0.33;
POPSpringAnimation *animation = [self pop_animationForKey:@"treeWaveAnimation"];

if (!animation) {
animation = [POPSpringAnimation animation];
animation.springBounciness = 30;
animation.springSpeed = 5;
animation.fromValue = @(-0.33);
animation.toValue =@(0.01);
animation.completionBlock = ^(POPAnimation *anim, BOOL finished){

if (finished) {
Expand All @@ -236,7 +243,7 @@ - (void)setTreeWave{

[self pop_addAnimation:animation forKey:@"treeWaveAnimation"];
}
animation.toValue =@(0.01);

}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
Expand Down