Created
August 30, 2016 20:52
-
-
Save darknoon/fc135cbc22a79ee5fd6025855f419d04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)_setValue:(CGFloat)value forAnimatedKey:(NSString *)animationKey | |
{ | |
POPSpringAnimation *ps = [self pop_animationForKey:animationKey]; | |
if (!ps) { | |
ps = [POPSpringAnimation animation]; | |
ps.property = [POPAnimatableProperty propertyWithName:animationKey initializer:^(POPMutableAnimatableProperty *prop) { | |
prop.readBlock = ^(DEViewerView *view, CGFloat *vs) { | |
vs[0] = [[view valueForKey:animationKey] floatValue]; | |
}; | |
prop.writeBlock = ^(DEViewerView *view, const CGFloat *vs) { | |
[view setValue:@(vs[0]) forKey:animationKey]; | |
[view setNeedsLayout]; | |
}; | |
prop.threshold = 0.0001; | |
}]; | |
ps.dynamicsFriction = fromQCFriction(8); | |
ps.dynamicsTension = fromQCTension(30); | |
[self pop_addAnimation:ps forKey:animationKey]; | |
} | |
ps.toValue = @(value); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment