Easing
A library that implements easing functions in Swift.
Supported platforms:
iOS, macOS, tvOS, watchOS and Linux (latest Ubuntu).
Type of supported functions:
- Quadratic
- Cubic
- Quartic
- Quintic
- Sine
- Circular
- Exponential
- Elastic
- Back
- Bounce
Each type has its own separate ease-In, ease-Out and ease-In-Out form.
The functions are design to accept a generic floating-point input parameter,
and return a floating-point, denoting the rate of change of a property over time.
Supported argument types:
- Any type that conforms to the
Real
protocol, e.g.Float
Float80
Double
Usage:
The Curve type allows access to all the different functions, for example:
Here's an example of the use of the elastic ease-in-out function in an array of 75 points in the [0, 1] interval.
Installation:
Swift Package Manager (iOS, macOS, tvOS, watchOS and Linux)
Add Easing
to your AwsomeProject
, by adding the github URL to your Package.swift
, e.g.:
-
To quickly generate a Xcode project, navigate to the project folder in the terminal and run:
swift package generate-xcodeproj
(In order to generate an
Easing.xcodeproj
from the project'sPackage.swift
, be sure to have the Swift compiler installed andSwift
added to your $PATH) -
To quickly run the tests:
(on macOS)
swift test
(on Linux)
swift test --enable-test-discovery
.
Dependencies:
- Apple's
RealModule
from the Swift Numerics package.