- iOS, macOS, tvOS, watchOS and Linux (latest Ubuntu).
- 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
Realprotocol, e.g.FloatFloat80Double
The Curve type allows access to all the different functions, for example:
letx:Float=0.3lety=Curve.quadratic.easeIn(x) // y = 0.09letx:Double=0.5lety=Curve.sine.easeOut(x2) // y = 0.7071067811865 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.
Add Easing to your AwsomeProject, by adding the github URL to your Package.swift, e.g.:
// swift-tools-version:5.0
import PackageDescription
letpackage=Package(
name:"AwsomeProject",
dependencies:[.package(url:"https://github.com/manuelCarlos/Easing.git",.upToNextMajor(from:"2.0.0"))],
targets:[.target(
name:"AwsomeProject",
dependencies:["Easing"])])To quickly run the tests:
(on macOS)
swift test(on Linux)
swift test --enable-test-discovery
- Apple's
RealModulefrom the Swift Numerics package.
