Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers

Overview

Ease

Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers. It's magic.

Features

  • Animate any value type
  • Set multiple animations for a single value
  • Animation trajectories update when you update the targetValue
  • Add natural spring behavior to any value change
  • Optimized for Swift 5
  • Compatible with iOS 9 and up

Supported value types

  • CGFloat
  • CGPoint
  • CGSize
  • CGVector
  • Int
  • Float
  • Double
  • SCNVector3

Easily extendible with more (custom) types.

Examples

How

Create your Ease object with an initial value

var ease: Ease = Ease(view.center, minimumStep: 0.001)

Add your custom spring-animation(s)

ease.addSpring(tension: 300, damping: 15, mass: 1) { position in
    view.center = position
}

Set the target value of your Ease object and adjust your target as often as you want

ease.targetValue = gestureRecognizer.location(in: view)

Memory management

For a single spring-animation you can store the returned EaseDisposable to a variable

disposable = ease.addSpring(tension...

For multiple spring-animations you can add the disposable to a EaseDisposal variable

ease.addSpring(tension...) { }.add(to: &disposal)

And always weakify self when referencing self inside your spring-animation

ease.addSpring(tension...) { [weak self] position in

Installation

Ease is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Ease'

Suggestions or feedback?

Feel free to create a pull request, open an issue or find me on Twitter.

You might also like...
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey 🍯 to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Sample way of integrating animations into a design system for iOS app projects.

Animations in Design System The project presents a sample way of integrating animations into a design system for iOS developers. Project setup A sampl

YapAnimator is your fast and friendly physics-based animation system
YapAnimator is your fast and friendly physics-based animation system

YapAnimator is your fast and friendly physics-based animation system. YapAnimator was built with ease-of-use in mind, keeping you sane and your design

A simple spritesheet animation system for Raylib on Swift.
A simple spritesheet animation system for Raylib on Swift.

About A simple spritesheet animation system for Raylib on Swift. Aeni allows you to quickly and easily animate your spritesheet in your Raylib for Swi

A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.
A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.

AnimatedCollectionViewLayout Normally a UICollectionView has no transition effects when you scroll from one item to another. There are lots of ways to

Custom MacBook keyboard backlight animations
Custom MacBook keyboard backlight animations

KBPulse Pulse the backlight on your Mac keyboard Demo Configuration Configuration files (.json) are stored in ~/Documents/KBPulse. (This location will

Easily build advanced custom animations on iOS.
Easily build advanced custom animations on iOS.

INTUAnimationEngine makes it easy to build advanced custom animations on iOS. INTUAnimationEngine provides a friendly interface to drive custom animat

A library of custom iOS View Controller Animations and Interactions.
A library of custom iOS View Controller Animations and Interactions.

RZTransitions is a library to help make iOS7 custom View Controller transitions slick and simple. Installation CocoaPods (Recommended) Add the followi

Simple Interface Core Animation. Run type-safe animation sequencially or parallelly
Simple Interface Core Animation. Run type-safe animation sequencially or parallelly

Simple Interface Core Animation Sica can execute various animations sequentially or parallelly. Features Animation with duration and delay parallel /

Comments
  • Ease complete notification

    Ease complete notification

    Hi, thanks for the great utility. I’m trying to execute some code once the spring animation is complete so trying to work out how best to get notified that the Ease isPaused or has reached the target value.

    opened by whiteangle 5
  • Package.swift

    Package.swift

    Adding a Package.swift allows anyone to add Ease as a SPM dependency through Xcode 11 or manually.

    *.podspec linguist-vendored gets the project to display "Swift 100%" in Github.

    opened by hallee 2
  • compile error in Example 3D (Easy3DSceneKit/GameViewController.swift)

    compile error in Example 3D (Easy3DSceneKit/GameViewController.swift)

    Noticed a compile-error: line 69: Easy3DSceneKit/GameViewController.swift Extra argument 'damping' in call

    ease.addSpring(tension: tension, damping: damping, mass: mass) { point, _ in childNode.runAction(SCNAction.rotateTo(x: point.y / 35, y: point.x / 250, z: 0, duration: 0)) }.add(to: &disposal)

    similar error in Example project as well.

    opened by lingolab2 1
  • Example3D crash

    Example3D crash

    failed assertion `RenderPass Descriptor Validation MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action for the depth attachment is not supported by device PixelFormat MTLPixelFormatDepth32Float cannot be a MSAA resolve target

    xcode 13.1 iOS 15 iphonesimulator

    opened by ccworld1000 1
Releases(3.2.0)
Owner
Robert-Hein Hooijmans
iOS Developer
Robert-Hein Hooijmans
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks

SwiftUI Animation Observer Track SwiftUI animation progress and completion via c

Gordan Glavaš 9 Nov 5, 2022
Wave is a spring-based animation engine for iOS that makes it easy to create fluid, interruptible animations that feel great.

Wave is a spring-based animation engine for iOS and iPadOS. It makes it easy to create fluid, interactive, and interruptible animations that feel great.

Janum Trivedi 1.2k Jan 8, 2023
Swiftui Spring Animations

Swiftui Spring Animations This repository serves as your reference for SwiftUI Spring Animations. It demonstrates use cases for the various types of s

Stream 348 Dec 30, 2022
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

Marin Todorov 3k Dec 27, 2022
Aplikacja realizowana w ramach rekrutacji na staż Allegro Spring TECH e-Xperience 2022

RepoFinderAllegro Aplikacja realizowana w ramach rekrutacji na staż Allegro Spring TECH e-Xperience 2022 Uruchamianie Do uruchomienia aplikacji potrze

null 0 Jan 9, 2022
Swift interpolation for gesture-driven animations

Interpolate Interpolate is a powerful Swift interpolation framework for creating interactive gesture-driven animations. Usage The ?? idea of Interpola

Roy Marmelstein 1.8k Dec 20, 2022
Designed for gesture-driven animations. Fast, simple, & extensible!

Yet Another Animation Library Designed for gesture-driven animations. Fast, simple, & extensible! It is written in pure swift 3.1 with protocol orient

Luke Zhao 509 Dec 21, 2022
An experiment for using SwiftUI's custom timing Animation to create an orbital-like animation.

Orbital-SwiftUI-Animation An experiment for using SwiftUI's custom timing curve to create an orbital-like animation. How it looks: How it works: Apply

Mostafa Abdellateef 7 Jan 2, 2023
A collection of animations for iOS. Simple, just add water animations.

DCAnimationKit A collection of animations for iOS Simply, just add water! DCAnimationKit is a category on UIView to make animations easy to perform. E

Dalton 797 Sep 23, 2022
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey ?? to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Sagaya Abdulhafeez 150 Dec 23, 2021