pop 动画

这几天专心写一下pop动画

好的代码贴在下方:


```objc

POPAnimatableProperty *constantProperty = [POPAnimatableProperty propertyWithName:@"constant" initializer:^(POPMutableAnimatableProperty *prop){

prop.readBlock = ^(NSLayoutConstraint *layoutConstraint, CGFloat values[]) {

values[0] = [layoutConstraint constant];

};

prop.writeBlock = ^(NSLayoutConstraint *layoutConstraint, const CGFloat values[]) {

[layoutConstraint setConstant:values[0]];

};

}];

POPSpringAnimation *constantAnimation = [POPSpringAnimation animation];

constantAnimation.property = constantProperty;

constantAnimation.fromValue = @(self.bottomSpace.constant);

constantAnimation.toValue = @(0);

[self.bottomSpace pop_addAnimation:constantAnimation forKey:@"constantAnimation"];

```

你可能感兴趣的:(pop 动画)