Swiftpack.co -  manuelCarlos/Easing as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
manuelCarlos/Easing
Easing functions in Swift 5
.package(url: "https://github.com/manuelCarlos/Easing.git", from: "2.0.6")

License: MIT release

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:

let x: Float = 0.3
let y = Curve.quadratic.easeIn(x) // y = 0.09
let x: Double = 0.5
let y = 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.

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.:

// swift-tools-version:5.0

import PackageDescription

let package = 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 generate a Xcode project, navigate to the project folder in the terminal and run:

    swift package generate-xcodeproj

    (In order to generate an Easing.xcodeprojfrom the project's Package.swift, be sure to have the Swift compiler installed and Swift added to your $PATH)

  • To quickly run the tests:

    (on macOS)

    swift test

    (on Linux)

    swift test --enable-test-discovery .

Dependencies:

GitHub

link
Stars: 108
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Clean up Float80 instances from Tests
33 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API