https://github.com/calm/calmparametricanimations
Extends native CAKeyframeAnimations to use all of the complex easing functions found at http://www.easings.net
https://github.com/calm/calmparametricanimations
Last synced: about 1 year ago
JSON representation
Extends native CAKeyframeAnimations to use all of the complex easing functions found at http://www.easings.net
- Host: GitHub
- URL: https://github.com/calm/calmparametricanimations
- Owner: calm
- License: mit
- Created: 2016-11-03T17:40:49.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-03T17:48:18.000Z (almost 10 years ago)
- Last Synced: 2025-06-12T21:12:10.632Z (about 1 year ago)
- Language: Objective-C
- Size: 7.81 KB
- Stars: 1
- Watchers: 29
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CalmParametricAnimations
A nice iOS extension that gives `CAKeyframeAnimation` support for all of the complex easing curves found at http://easings.net
## Installation
Add `pod 'CalmParametricAnimations'` to your `Podfile` or download the source [here](https://github.com/calm/CalmParametricAnimations)
## Curves
`CalmParametricAnimations` supports the following curves (type `ParametricTimeBlock`):
```
typedef double (^ParametricTimeBlock)(double time)
sineIn
sineOut
sineInOut
squashedSineInOut
linear
appleIn
appleOut
appleInOut
backIn
backOut
backInOut
easeInBackOut
easeOutDramatic
quadraticIn
quadraticOut
cubicIn
cubicOut
cubicInOut
circularIn
circularOut
expoIn
expoOut
expoInOut
elasticIn
elasticOut
variableElasticOut (intensity) -> ParametricTimeBlock
bezierEvaluator (time, point1, point2) -> ParametricTimeBlock
arc (radius, center) -> ParametricTimeBlock
```
These can the be evaluated directly as functions passing `double` time from 0 - 1, or by using one of the "value blocks" we’ve defined:
```
double
point
size
rect
color
transform3D
```
Each of these value blocks has a corresponding extension method on CAKeyframeAnimation that allows passing of the key-path, the time function. For example:
```
+ (instancetype)animationWithKeyPath:(NSString *)path
timeFxn:(ParametricTimeBlock)timeFxn
fromRect:(CGRect)fromValue
toRect:(CGRect)toValue;
```
which will producte an animation that interpolates between the two rects according to the easing curve, with the duration set after initialization.