在Objective-C中实现易读链式动画写法:JHChainableAnimations

jopen 7年前

JHChainableAnimations让你能够在Objective-C中实现易读链式动画写法。

在Objective-C中实现易读链式动画写法:JHChainableAnimations

在Objective-C中实现易读链式动画写法:JHChainableAnimations
 在Objective-C中实现易读链式动画写法:JHChainableAnimations

老的写法
    [UIView animateWithDuration:1.0 delay:0.0 usingSpringWithDamping:0.8 initialSpringVelocity:1.0 options:0 animations:^{ CGPoint newPosition = self.myView.frame.origin;                              newPosition.x += 50;                              self.myView.frame.origin = newPosition;      } completion:^(BOOL finished) {          [UIView animateWithDuration:0.5 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{              self.myView.backgroundColor = [UIColor purpleColor];          } completion:nil];      }];

利用JHChainableAnimations只要一行代码就能搞定

新的写法(JHChainableAnimations!!!)

self.myView.moveX(50).spring.thenAfter(1.0).makeBackground([UIColor purpleColor]).easeIn.animate(0.5);

项目主页:http://www.open-open.com/lib/view/home/1431672536388