This library was created for general usage when keyframe animations used and key values can't be easily interpolated thru animation progress.
Here is the list of available easing functions:
In | Out | InOut | OutIn | |
---|---|---|---|---|
Linear | ![]() |
![]() |
![]() |
![]() |
Sinusoidal | ![]() |
![]() |
![]() |
![]() |
Quadratic | ![]() |
![]() |
![]() |
![]() |
Cubic | ![]() |
![]() |
![]() |
![]() |
Quartic | ![]() |
![]() |
![]() |
![]() |
Quintic | ![]() |
![]() |
![]() |
![]() |
Exponential | ![]() |
![]() |
![]() |
![]() |
Circular | ![]() |
![]() |
![]() |
![]() |
Back | ![]() |
![]() |
![]() |
![]() |
Bounce | ![]() |
![]() |
![]() |
![]() |
Elastic | ![]() |
![]() |
![]() |
![]() |
This library can be used in two ways: OOP and functional.
In the first case easing function represents one of the next objects instance(they all are childs of ESQEasingFunction
):
ESQLinearEasingFunction
ESQSinusoidalEasingFunction
ESQQuadraticEasingFunction
ESQCubicEasingFunction
ESQQuarticEasingFunction
ESQQuinticEasingFunction
ESQExponentialEasingFunction
ESQCircularEasingFunction
ESQBackEasingFunction
ESQBounceEasingFunction
ESQElasticEasingFunction
Those object can be instantiated in the few ways:
- Without any parameters, default values will be used for type(
ESQEasingFunctionTypeOut
) and parameters
CGFloat progress = ...
ESQEasingFunction *easingFunction = [[ESQElasticEasingFunction alloc] init];
CGFloat easedProgress = [easingFunction easedProgress:progress];
- With specified type(if functiona also have a parameters default values will be used)
CGFloat progress = ...
ESQEasingFunction *easingFunction = [ESQElasticEasingFunction easingFunctionWithType:ESQEasingFunctionTypeInOut];
CGFloat easedProgress = [easingFunction easedProgress:progress];
- With specified type and parameters:
CGFloat customAmplitude = ...
CGFloat progress = ...
ESQEasingFunction *easingFunction = [ESQElasticEasingFunction easingFunctionWithType:ESQEasingFunctionTypeInOut amplitude:customAmplitude period:ESQDefaultElasticPeriod];
CGFloat easedProgress = [easingFunction easedProgress:progress];
Also, if you preffer funcitons or need more perfomance you may use easing functions which can provide the same results as using objects. Here is the list of all available easing funcitons:
In | Out | InOut | OutIn | |
---|---|---|---|---|
Linear | linearIn(p) |
linearOut(p) |
linearInOut(p) |
linearOutIn(p) |
Sinusoidal | sinusoidalIn(p) |
sinusoidalOut(p) |
sinusoidalInOut(p) |
sinusoidalOutIn(p) |
Quadratic | quadraticIn(p) |
quadraticOut(p) |
quadraticInOut(p) |
quadraticOutIn(p) |
Cubic | cubicIn(p) |
cubicOut(p) |
cubicInOut(p) |
cubicOutIn(p) |
Quartic | quarticIn(p) |
quarticOut(p) |
quarticInOut(p) |
quarticOutIn(p) |
Quintic | quinticIn(p) |
quinticOut(p) |
quinticInOut(p) |
quinticOutIn(p) |
Exponential | exponentialIn(p) |
exponentialOut(p) |
exponentialInOut(p) |
exponentialOutIn(p) |
Circular | circularIn(p) |
circularOut(p) |
circularInOut(p) |
circularOutIn(p) |
Back | backIn(p, o) |
backOut(p, o) |
backInOut(p, o) |
backOutIn(p, o) |
Bounce | bounceIn(p, o) |
bounceOut(p, o) |
bounceInOut(p, o) |
bounceOutIn(p, o) |
Elastic | elasticIn(p, a, q) |
elasticOut(p, a, q) |
elasticInOut(p, a, q) |
elasticOutIn(p, a, q) |
Every function should obtain progress as input and a few parameters(if needed).
CGFloat customAmplitude = ...
CGFloat progress = ...
CGFloat easedProgress = elasticInOut(progress, customAmplitude, ESQDefaultElasticPeriod);
Pleae, take a note, that default values for functions provided available in each header where this funciton described.
easeqs-objc is available through CocoaPods or may be easily build from source.
If you're using Swift, you may wish to install dynamic frameworks, which can be done with the Podfile shown below:
platform :ios, '9.0'
use_frameworks!
pod 'easeqs-objc'
- Add 4 dimensions structures keyframe animaiton support(CGRect)
- Add Carthage support
- Think about better way to describe multiple easing funcitons for the animaiton of complex structures(2 or more dimensional)
- Create Swift version