<commit_before># ![INTUAnimationEngine](https://github.com/intuit/AnimationEngine/blob/master/Images/INTUAnimationEngine.png?raw=true)
INTUAnimationEngine makes it easy to build advanced custom animations on iOS.

INTUAnimationEngine provides a friendly interface to drive custom animations using a CADisplayLink, inspired by the UIView block-based animation API. It enables interactive animations (normally driven by user input, such as a pan or pinch gesture) to run automatically over a given duration. It can also be used to get a callback every frame of an animation.

INTUAnimationEngine includes an extensive library of easing functions that can be used to customize animation timing. A complete library of interpolation functions is also included to animate any type of value or property, including those that are not animatable by Core Animation.

## Installation
*INTUAnimationEngine requires iOS 5.0 or later.*

**Using [CocoaPods](http://cocoapods.org)**

1.	Add the pod `INTUAnimationEngine` to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html).

    	pod 'INTUAnimationEngine'

2.	Run `pod install` from Terminal, then open your app's `.xcworkspace` file to launch Xcode.
3.	`#import "INTUAnimationEngine.h"` wherever you want to use it.

**Manually from GitHub**

1.	Download all the files in the [Source directory](https://github.com/intuit/AnimationEngine/tree/master/Source).
2.	Add all the files to your Xcode project (drag and drop is easiest).
3.	`#import "INTUAnimationEngine.h"` wherever you want to use it.

## Usage
The major difference between INTUAnimationEngine and the UIView animation methods is how the `animations` block works. With the UIView methods, the `animations` block is only executed once, and the changes made to views within this block represent the new state at the end of the animation.

With INTUAnimationEngine, the `animations` block is called many times during the animation (once per frame), and each time it is called, your code should update the state of views based upon the current value of the `percentage` or `progress` passed into the block. Typically, you'll want to use one of the interpolation functions included in this library to help generate all the intermediate values between the start and end states for a given property.

### Animation Engine
INTUAnimationEngine has two API methods that can be used to start an animation.

#### Without Easing (Linear)
	+ (NSInteger)animateWithDuration:(NSTimeInterval)duration
	                           delay:(NSTimeInterval)delay
	                      animations:(void (^)(CGFloat percentage))animations
	                      completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the `animations` block each frame of the animation, passing in a `percentage` value that represents the current percentage complete. The `completion` block will be executed when the animation completes, with the `finished` parameter indicating whether the animation was cancelled.

#### With Easing
	+ (NSInteger)animateWithDuration:(NSTimeInterval)duration
	                           delay:(NSTimeInterval)delay
	                          easing:(INTUEasingFunction)easingFunction
	                      animations:(void (^)(CGFloat progress))animations
	                      completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the `animations` block each frame of the animation, passing in a `progress` value that represents the current progress of the animation (taking into account the easing function). The `easingFunction` can be any of the easing functions in [`INTUEasingFunctions.h`](https://github.com/intuit/AnimationEngine/tree/master/Source/INTUEasingFunctions.h), or a custom function. The `completion` block will be executed when the animation completes, with the `finished` parameter indicating whether the animation was cancelled.

#### Canceling Animations
	+ (void)cancelAnimationWithID:(NSInteger)animationID;

When starting an animation, you can store the returned animation ID, and pass it to the above method to cancel the animation before it completes. If the animation is cancelled, the completion block will execute with `finished` parameter equal to NO.

### Easing Functions
[`INTUEasingFunctions.h`](https://github.com/intuit/AnimationEngine/tree/master/Source/INTUEasingFunctions.h) is a C library of standard easing functions. Here's a [handy cheat sheet](http://easings.net) that includes visualizations and animation demos for these functions.

### Interpolation Functions<commit_msg>Update README to reflect latest API<commit_after># ![INTUAnimationEngine](https://github.com/intuit/AnimationEngine/blob/master/Images/INTUAnimationEngine.png?raw=true)
INTUAnimationEngine makes it easy to build advanced custom animations on iOS.

INTUAnimationEngine provides a friendly interface to drive custom animations using a CADisplayLink, inspired by the UIView block-based animation API. It enables interactive animations (normally driven by user input, such as a pan or pinch gesture) to run automatically over a given duration. It can also be used to get a callback every frame of an animation.

INTUAnimationEngine includes an extensive library of easing functions that can be used to customize animation timing. A complete library of interpolation functions is also included to animate any type of value or property, including those that are not animatable by Core Animation.

## Installation
*INTUAnimationEngine requires iOS 5.0 or later.*

**Using [CocoaPods](http://cocoapods.org)**

1.	Add the pod `INTUAnimationEngine` to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html).

    	pod 'INTUAnimationEngine'

2.	Run `pod install` from Terminal, then open your app's `.xcworkspace` file to launch Xcode.
3.	`#import "INTUAnimationEngine.h"` wherever you want to use it.

**Manually from GitHub**

1.	Download all the files in the [Source directory](https://github.com/intuit/AnimationEngine/tree/master/Source).
2.	Add all the files to your Xcode project (drag and drop is easiest).
3.	`#import "INTUAnimationEngine.h"` wherever you want to use it.

## Usage
The major difference between INTUAnimationEngine and the UIView animation methods is how the `animations` block works. With the UIView methods, the `animations` block is only executed once, and the changes made to views within this block represent the new state at the end of the animation.

With INTUAnimationEngine, the `animations` block is called many times during the animation (once per frame), and each time it is called, your code should update the state of views based upon the current value of the `percentage` or `progress` passed into the block. Typically, you'll want to use one of the interpolation functions included in this library to help generate all the intermediate values between the start and end states for a given property.

### Animation Engine
INTUAnimationEngine has a few API methods that can be used to start an animation.

#### Without Easing (Linear)
	+ (INTUAnimationID)animateWithDuration:(NSTimeInterval)duration
	                                 delay:(NSTimeInterval)delay
	                            animations:(void (^)(CGFloat percentage))animations
	                            completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the `animations` block each frame of the animation, passing in a `percentage` value that represents the current percentage complete. The `completion` block will be executed when the animation completes, with the `finished` parameter indicating whether the animation was cancelled.

#### With Easing
	+ (INTUAnimationID)animateWithDuration:(NSTimeInterval)duration
	                                 delay:(NSTimeInterval)delay
	                                easing:(INTUEasingFunction)easingFunction
	                            animations:(void (^)(CGFloat progress))animations
	                            completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the `animations` block each frame of the animation, passing in a `progress` value that represents the current progress of the animation (taking into account the easing function). The `easingFunction` can be any of the easing functions in [`INTUEasingFunctions.h`](https://github.com/intuit/AnimationEngine/tree/master/Source/INTUEasingFunctions.h), or a custom function. The `completion` block will be executed when the animation completes, with the `finished` parameter indicating whether the animation was cancelled.

There is also another variant of the above method that takes an `options:` parameter, which is a mask of `INTUAnimationOptions`. This can be used to repeat or autoreverse animations.

#### Canceling Animations
	+ (void)cancelAnimationWithID:(INTUAnimationID)animationID;

When starting an animation, you can store the returned animation ID, and pass it to the above method to cancel the animation before it completes. If the animation is cancelled, the completion block will execute with `finished` parameter equal to NO.

### Easing Functions
[`INTUEasingFunctions.h`](https://github.com/intuit/AnimationEngine/tree/master/Source/INTUEasingFunctions.h) is a C library of standard easing functions. Here's a [handy cheat sheet](http://easings.net) that includes visualizations and animation demos for these functions.

### Interpolation Functions
{'fraction_non_alphanumeric': 0.06703204047217538, 'fraction_numerical': 0.0016863406408094434, 'mean_word_length': 4.388415672913117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5636927', 'n_tokens_mistral': 2348, 'n_tokens_neox': 2240, 'n_words': 1104}