From 9a8bdfbb8758089ed77be81f53a0a3593602c607 Mon Sep 17 00:00:00 2001 From: Matthew Cheok Date: Sun, 4 May 2014 18:17:44 +0800 Subject: [PATCH] Release 0.2 --- POP+MCAnimate.podspec | 2 +- README.md | 68 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/POP+MCAnimate.podspec b/POP+MCAnimate.podspec index b242a30..6b84825 100644 --- a/POP+MCAnimate.podspec +++ b/POP+MCAnimate.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'POP+MCAnimate' - s.version = '0.1' + s.version = '0.2' s.platform = :ios, '7.0' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'Concise syntax for the Pop animation framework.' diff --git a/README.md b/README.md index 0d2e129..9839ffb 100644 --- a/README.md +++ b/README.md @@ -32,20 +32,76 @@ With this: self.boxView.spring.bounds = CGRectMake(0, 0, 200, 200); -## Additional Configuration +### Spring Animation -The animation proxies `spring`, `decay`, `linear`, `easeIn`, `easeOut` and `easeInEaseOut` are provided on `NSObject`. You can set the `toValue` of the animation by setting properties on these proxies. +You can configure `velocity`, `springBounciness` and `springSpeed`. -In addition, there is a `velocity` proxy to take velocities values for spring and decay animations. Velocities expire after one animation. Additional properties `springBounciness` and `springSpeed` are provided on `NSObject` for spring animations and `decayDeceleration` for decay animations. + self.boxView.velocity.center = [pan velocityInView:self.boxView]; + self.boxView.springBounciness = 20; + self.boxView.springSpeed = 20; + self.boxView.spring.center = viewCenter; -Because decay animations take no `toValue`, they are created as follows: +### Decay Animation - self.boxView.velocity.center = CGPointMake(100, 100); +You can configure `velocity` and `decayDeceleration`. + + self.boxView.velocity.center = [pan velocityInView:self.boxView]; + self.boxView.decayDeceleration = 0.998; [self.boxView.decay center]; +### Basic Animation + +You can configure `duration` and use different timing functions by swapping out `easeInEaseOut` for `easeIn`, `easeOut` or `linear`. + + self.boxView.duration = 1; + self.boxView.easeInEaseOut.center = viewCenter; + + +### Grouping and Completion Handlers + +Block-based methods are provided on `NSObject` similar to UIKit block-based animation methods. The `completion` block waits for all animations in the `animate` block to complete before executing. + + [NSObject animate:^{ + self.boxView.spring.alpha = 0.5; + self.boxView.spring.bounds = CGRectMake(0, 0, 200, 200); + self.boxView.spring.backgroundColor = [UIColor blueColor]; + } completion:^(BOOL finished) { + self.boxView.alpha = 1; + self.boxView.spring.bounds = CGRectMake(0, 0, 100, 100); + self.boxView.spring.backgroundColor = [UIColor redColor]; + self.boxView.spring.center = viewCenter; + }]; + ## Remarks -Currently only Pop animatable properties that correspond directly to `UIView` and `CALayer` properties are supported. +Currently only Pop animatable properties that correspond directly to UIKit properties are supported. + +The list of supported properties are: +- **CALayer** (and subclasses) + - backgroundColor + - bounds + - opacity + - position + - zPosition + +- **CAShapeLayer** + - strokeColor + - strokeStart + - strokeEnd + +- **NSLayoutConstraint** + - constant + +- **UIView** (and subclasses) + - alpha + - backgroundColor + - bounds + - center + - frame + +- **UIScrollView** (and subclasses) + - contentOffset + - contentSize ## License