• This repository has been archived on 21/Dec/2023
  • Stars
    star
    1,058
  • Rank 41,958 (Top 0.9 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easily build advanced custom animations on iOS.

INTUAnimationEngine

Build Status Test Coverage Version Platform License

INTUAnimationEngine makes it easy to build advanced custom animations on iOS.

INTUAnimationEngine provides a friendly interface to drive custom animations using a CADisplayLink, inspired by the UIView block-based animation API. It enables interactive animations (normally driven by user input, such as a pan or pinch gesture) to run automatically over a given duration. It can also be used to get a callback every frame of an animation.

INTUAnimationEngine includes an extensive library of easing functions that can be used to customize animation timing, as well as a complete library of interpolation functions to animate any type of value or property including those that are not animatable by Core Animation.

The project also includes a standalone spring physics library to simulate damped harmonic motion. This is used under the hood to power a spring animation API on INTUAnimationEngine that allows full control over the damping, stiffness, and mass parameters. Since the spring solver is a completely independent and generic library implemented in pure C, it can be used on its own for many other applications apart from animation.

Installation

INTUAnimationEngine requires iOS 5.0 or later.

Using CocoaPods

  1. Add the pod INTUAnimationEngine to your Podfile.
pod 'INTUAnimationEngine'
  1. Run pod install from Terminal, then open your app's .xcworkspace file to launch Xcode.
  2. Import the INTUAnimationEngine.h header. Typically, this should be written as #import <INTUAnimationEngine/INTUAnimationEngine.h>.

Installing the Spring Solver Library Only

The Spring Solver used by INTUAnimationEngine is available as a standalone C library, where it can be used for other applications (including ones that are not related to animation). The Spring Solver has its own CocoaPods subspec so that it can be installed separately from the rest of the INTUAnimationEngine project. To install the Spring Solver only, add the following line to your Podfile:

pod 'INTUAnimationEngine/SpringSolver'

Note that installing INTUAnimationEngine using pod 'INTUAnimationEngine' automatically includes the Spring Solver library as a dependency.

Manually from GitHub

  1. Download the contents of the INTUAnimationEngine directory.
  2. Add all the files to your Xcode project (drag and drop is easiest).
  3. Import the INTUAnimationEngine.h header.

Usage

The primary difference between INTUAnimationEngine and the UIView animation methods is how the animations block works. With the UIView methods, the animations block is only executed once, and the changes made to views within this block represent the new state at the end of the animation.

With INTUAnimationEngine, the animations block is executed many times during the animation (once per frame), and each time it is executed, your code inside the block should update the state of views based upon the current value of the percentage or progress passed into the block. Typically, you'll want to use one of the interpolation functions included in this library to help generate all the intermediate values between the start and end states for a given property.

Animation Engine

There are a few different API methods on INTUAnimationEngine that can be used to start an animation.

Without Easing (Linear)

+ (INTUAnimationID)animateWithDuration:(NSTimeInterval)duration
                                 delay:(NSTimeInterval)delay
                            animations:(void (^)(CGFloat percentage))animations
                            completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the animations block each frame of the animation, passing in a percentage value that represents the animation's current percentage complete. The completion block will be executed when the animation completes, with the finished parameter indicating whether the animation was canceled.

With Easing

+ (INTUAnimationID)animateWithDuration:(NSTimeInterval)duration
                                 delay:(NSTimeInterval)delay
                                easing:(INTUEasingFunction)easingFunction
                            animations:(void (^)(CGFloat progress))animations
                            completion:(void (^)(BOOL finished))completion;

This method will start an animation that calls the animations block each frame of the animation, passing in a progress value that represents the current progress of the animation (taking into account the easing function). The easingFunction can be any of the easing functions in INTUEasingFunctions.h, or a block that defines a custom easing curve. The completion block will be executed when the animation completes, with the finished parameter indicating whether the animation was canceled.

There is also another variant of the above method that takes an options: parameter, which is a mask of INTUAnimationOptions. This can be used to repeat or autoreverse animations.

Using a Spring

+ (INTUAnimationID)animateWithDamping:(CGFloat)damping
                            stiffness:(CGFloat)stiffness
                                 mass:(CGFloat)mass
                                delay:(NSTimeInterval)delay
                           animations:(void (^)(CGFloat progress))animations
                           completion:(void (^)(BOOL finished))completion;

This method will start a spring animation that calls the animations block each frame of the animation, passing in a progress value that represents the current progress of the animation. The animation will simulate the physics of a spring-mass system with the specified properties:

  • damping – The amount of friction. Must be greater than or equal to zero. If exactly zero, the harmonic motion will continue indefinitely. Typical range: 1.0 to 30.0
  • stiffness – The stiffness of the spring. Must be greater than zero. Typical range: 1.0 to 500.0
  • mass – The amount of mass being moved by the spring. Must be greater than zero. Typical range: 0.1 to 10.0

Note that the total duration of the animation is determined by simulating a spring-mass system with the above parameters until it reaches a resting state. The completion block will be executed when the animation completes, with the finished parameter indicating whether the animation was canceled.

Canceling Animations

+ (void)cancelAnimationWithID:(INTUAnimationID)animationID;

When starting an animation, you can store the returned animation ID, and pass it to the above method to cancel the animation before it completes. If the animation is canceled, the completion block will execute with finished parameter equal to NO.

Easing Functions

INTUEasingFunctions.h is a library of standard easing functions. Here's a handy cheat sheet that includes visualizations and animation demos for these functions.

Interpolation Functions

INTUInterpolationFunctions.h is a library of interpolation functions.

Proximal Interpolation

For discrete values (where linear interpolation does not make sense), there are two proxmial interpolation functions. For example:

INTUInterpolateDiscrete(NSTextAlignmentLeft, NSTextAlignmentRight, progress)
// Returns NSTextAlignmentLeft when progress is < 0.5, NSTextAlignmentRight otherwise

[INTUInterpolateDiscreteValues(@[@(NSTextAlignmentLeft), @(NSTextAlignmentCenter), @(NSTextAlignmentRight)], progress) integerValue]
// Returns NSTextAlignmentLeft, then NSTextAlignmentCenter, and finally NSTextAlignmentRight as progress increases from 0.0 to 1.0

Linear Interpolation

For continuous values, there are a variety of linear interpolation functions. The following types are supported:

  • CGFloat
  • CGPoint
  • CGSize
  • CGRect
  • CGVector
  • UIOffset
  • UIEdgeInsets
  • UIColor / CGColor

There is also an untyped function INTUInterpolate() that takes values of type id and returns an interpolated value by automatically determining the type of the values. Proximal interpolation is used if the value types do not match, or if linear interpolation isn't supported for their type.

CGAffineTransform & CATransform3D

There are no functions that directly interpolate transforms. This is by design: linear interpolation of raw matrices often yields unexpected or invalid results. To interpolate between two transforms, decompose them into their translation, rotation, and scale components:

CGFloat rotation = INTUInterpolateCGFloat(0.0, M_PI, progress);
view.transform = CGAffineTransformMakeRotation(rotation);
// view will rotate from upright (progress = 0.0) to upside down (progress = 1.0)

You can concatenate transforms to combine them:

CGFloat rotation = INTUInterpolateCGFloat(0.0, M_PI, progress);
CGFloat scale = INTUInterpolateCGFloat(1.0, 0.5, progress);
view.transform = CGAffineTransformConcat(CGAffineTransformMakeScale(scale, scale), CGAffineTransformMakeRotation(rotation));
// view will rotate from upright and full size (progress = 0.0), to upside down and half size (progress = 1.0)
UIColor / CGColor

When interpolating between two colors, both colors must be in the same color space (grayscale, RGB, or HSB). Interpolating between colors in the HSB color space will generally yield better visual results than the RGB color space.

[UIColor colorWithWhite:1.0 alpha:1.0] // Grayscale color space; white
[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0] // RGB color space; white
[UIColor colorWithHue:0.0 saturation:0.0 brightness:1.0 alpha:1.0] // HSB color space; white

Spring Solver

The SpringSolver directory in the project contains a spring physics library to simulate damped harmonic motion, based on the spring solver that powers Facebook's Pop. The INTUAnimationEngine spring solver has been extensively refactored for simplicity and performance, and as a fully independent pure C library is highly portable to any platform and can be leveraged for other use cases beyond animation.

Example Project

An example project is provided. It requires Xcode 6 and iOS 6.0 or later.

Issues & Contributions

Please open an issue here on GitHub if you have a problem, suggestion, or other comment.

Pull requests are welcome and encouraged! There are no official guidelines, but please try to be consistent with the existing code style.

License

INTUAnimationEngine is provided under the MIT license. The spring solver library within the project is provided under a BSD license.

INTU on GitHub

Check out more iOS and OS X open source projects from Intuit!

More Repositories

1

karate

Test Automation Made Simple
Java
5,080
star
2

LocationManager

Easily get the device's current location on iOS.
Objective-C
2,560
star
3

CardParts

A reactive, card-based UI framework built on UIKit for iOS developers.
Swift
2,505
star
4

sdp

An Android lib that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size.
2,213
star
5

auto

Generate releases based on semantic version labels on pull requests.
TypeScript
2,191
star
6

wasabi

Wasabi A/B Testing service is an open source project that is no longer under active development or being supported
Java
1,128
star
7

ssp

Variant of sdp project based on the sp size unit.
537
star
8

design-systems-cli

A CLI toolbox for creating design systems.
TypeScript
394
star
9

QuickBooks-V3-PHP-SDK

Official PHP SDK for QuickBooks REST API v3.0: https://developer.intuit.com/
PHP
237
star
10

devtools-ds

UI components, libraries, and templates for building robust devtools experiences.
TypeScript
237
star
11

GroupedArray

An Objective-C and Swift collection for iOS and OS X that stores objects grouped into sections.
Objective-C
216
star
12

fuzzy-matcher

A Java library to determine probability of objects being similar.
Java
213
star
13

katlas

A distributed graph-based platform to automatically collect, discover, explore and relate multi-cluster Kubernetes resources and metadata.
Go
208
star
14

superglue

Superglue is a lineage-tracking tool built to help visualize the propagation of data through complex pipelines composed of tables, jobs and reports.
Scala
153
star
15

truffle-shuffle

An Android data-driven, percentage-based UI Card Gallery Library
Kotlin
147
star
16

maven-build-scanner

Know your build - so you can make it faster
Java
139
star
17

benten

Chatbot Development Framework (with Slack integration for Jira and Jenkins)
Java
133
star
18

foremast

Foremast adds application resiliency to Kubernetes by leveraging machine learnt patterns of application health to keep applications healthy and stable
Java
130
star
19

oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
JavaScript
116
star
20

costBuddy

costBuddy will gather cost information from multiple AWS accounts and generate a nice Grafana dashboard with alerting in place.
Python
111
star
21

Ignite

Modern markdown documentation generator
JavaScript
103
star
22

QuickBooks-V3-DotNET-SDK

.Net SDK for QuickBooks REST API v3 services
C#
102
star
23

accessibility-snippets

VSCode Snippets created to help developers write accessible code.
JavaScript
99
star
24

Trapheus

This tool automates restoration of RDS database instances from snapshots into any dev, staging or production environments. It supports individual RDS Snapshot as well as cluster snapshot restore operations.
Python
97
star
25

fawkes

🚀🚀 Fetch, parse, categorize, summarize user reviews 🚀🚀
Python
91
star
26

proof

A tapable integration testing library for your Storybook stories
TypeScript
86
star
27

Tank

Tank is a downloadable application that can be used to load test websites
Java
81
star
28

aws_account_utils

Deprecated - Utility to help create and modify your AWS account
Ruby
81
star
29

automation-for-humans

Converts English statements to automation.
Python
67
star
30

graphql-filter-java

This project is developed to help developers add filtering support to their graphql-java services
Java
66
star
31

simple_deploy

Maintenance Mode - Simple Deploy is an opinionated CLI tool for managing AWS Cloud Formation Stacks.
Ruby
64
star
32

oauth-pythonclient

The Python OAuth client provides a set of methods that make it easier to work with Intuit's OAuth and OpenID implementation.
Python
63
star
33

postcss-themed

A PostCSS plugin for generating themes.
TypeScript
61
star
34

QuickBooks-V3-Java-SDK

Java SDK for QuickBooks REST API v3 services
Java
60
star
35

commently

😀💬 Easily comment and update comments on GitHub PRs
TypeScript
56
star
36

AnimatedFormFieldTableViewCell

UITextField for iOS that enables the user to see both the Input Text and the Placeholder
Swift
56
star
37

autometer

Distributed load testing made simple
Shell
55
star
38

AutoRemoveObserver

iOS Auto-removing NSNotifications
Objective-C
51
star
39

Traverser

Traverser is a Java library that helps software engineers implement advanced iteration of a data structure.
Java
49
star
40

intuit-developer-nodejs

A starting point for anyone looking to quickly jump onto the Intuit Developer Platform, Intuit-developer-nodejs ties together OAuth, OpenID, NodeJS, QuickBooks APIs and SDK.
JavaScript
46
star
41

DockDockBuild

Support for running UNIX Makefiles on a Docker container
Kotlin
45
star
42

judo

Judo is an easy-to-use Command Line Interface (CLI) Integration Testing Framework, driven from a simple yaml file that also contains assertions.
JavaScript
45
star
43

react-json-reconciler

This project leverages the react-reconciler to allow users to serialize JSX trees into JSON objects.
TypeScript
45
star
44

bias-detector

Python
42
star
45

xhr-xdr-adapter

Enables (to the extent possible) support for Cross Origin Resource Sharing (CORS) on IE versions 8 and 9
JavaScript
41
star
46

user-data-for-fraud-prevention

Simple npm package with a utility to collect data from the browser required for compliance with fraud prevention APIs.
TypeScript
39
star
47

ami-query

Provide a REST interface to your organization's AMIs
Go
38
star
48

qb-animation-library

CSS and SCSS for adding QuickBooks animation to your project.
CSS
38
star
49

hooks

Hooks is a little module for plugins, in Kotlin
Kotlin
36
star
50

cyphfell

Converts WDIO to Cypress
JavaScript
34
star
51

storybook-addon-sketch

A Storybook add-on to get the contents of the current story as a Sketch file
TypeScript
31
star
52

saloon

An E2E test seeder for enterprise web applications
JavaScript
29
star
53

sac3

Official repo for SAC3: Reliable Hallucination Detection in Black-Box Language Models via Semantic-aware Cross-check Consistency
Jupyter Notebook
29
star
54

CloudRaider

A resiliency tool that automates Failure mode effect analysis tests, simplifying complex testing with a behavior-driven development and testing approach. Provides a programmatic way to execute controlled failures in AWS and a BDD way to write test cases, allowing test plans themselves to become test cases that can be executed as is.
Java
28
star
55

oauth-rubyclient

Ruby OAuth 2.0 client for QuickBooks Online
Ruby
27
star
56

identity-authz-apl

Attribute-based access control (ABAC), also known as policy-based access control, defines an access control paradigm whereby access rights are granted to users through the use of policies which reason over data in attributes. The policies can use any type of attributes (user attributes, resource attributes, object, environment attributes etc.). Read more here - https://en.wikipedia.org/wiki/Attribute-based_access_control ABAC Policy Language is used by ABAC to author policies. A policy consists of rules, which have "when" conditions and "then" actions. Policies are executed in a bounded time, goaled to reach a decision as quickly as possible in deterministic, fast and reliable way. Further light-weight execution consumes minimal resources.
Java
27
star
57

QuickFabric

A one-stop shop for all management and monitoring of Amazon Elastic Map Reduce (EMR) clusters across different AWS accounts and purposes.
JavaScript
26
star
58

metriks

Python package of commonly used metrics for evaluating information retrieval models.
Python
25
star
59

intuit-spring-cloud-config-inspector

Inspection of Spring Cloud Config properties made easy using React
JavaScript
25
star
60

mlctl

mlctl is the control plane for MLOps. It provides a CLI and a Python SDK for supporting key operations related to MLOps, such as "model training", "model hosting" etc.
Python
25
star
61

RBHC

This project implements machine learning to accomplish recursive binary hierarchical clustering of data primarily useful for any clickstream data along with providing cluster statistics for each cluster and visualization using d3js
Python
25
star
62

eslint-plugin-no-explicit-type-exports

A plugin to guard against exporting imported types.
TypeScript
24
star
63

istanbul-cobertura-badger

Create a Code Coverage badge for Node.js Apps running node-istanbul.
JavaScript
24
star
64

LD-React-Components

Semantic component helpers to support LaunchDarkly feature flags in your React app.
JavaScript
24
star
65

ts-readme

Generate docs from typescript and put it in a README
TypeScript
22
star
66

doc-blocks

A design system for doc-blocks UI components, built on @design-systems/cli.
TypeScript
22
star
67

text-provider

A react component which provides all the string constants using provider pattern
JavaScript
22
star
68

WeakForwarder

Objective-C NSProxy class for iOS and OS X to allow for real weak delegates.
Objective-C
22
star
69

node-pom-parser

Parsing Java's pom.xml and properly returning the json object, including attributes and values.
TypeScript
22
star
70

Decision-Trees-over-FHE

Decision trees training and prediction over encrypted data using Fully Homomorphic Encryption
C++
21
star
71

PHP-Payments-SDK

QuickBooks Online Payments SDK
PHP
20
star
72

rego

A command-line batch interface to the RuleFit statistical model building program.
R
20
star
73

universal-graph-client

A Java library that provides single API and a CLI to connect to all varieties of graph databases.
Java
19
star
74

innersource-scanner

A java api and command line tool for scanning, reporting and fixing a git repository's InnerSource Readiness based on a supplied specification which defines the files and file contents necessary for a repository to be considered ready for InnerSource contribution.
Java
19
star
75

funnel

A Go library that provides unification of identical operations (e.g. API requests).
Go
18
star
76

gitdetect

A GitHub scanning tool to help you find misplaced secrets in your source code repository files
Go
17
star
77

foremast-brain

Foremast-brain is a component of Foremast project.
Jupyter Notebook
17
star
78

ReplayWeb

ReplayWeb is a collection of tools to accelerate building and maintaining functional tests for user interfaces.
JavaScript
16
star
79

intuit-spring-cloud-config-validator

Validation tools for Spring Cloud Config repos: .json, .yam|, .yml and .properties, verified through script or GitHub Pre-receive Hook!
Python
16
star
80

heirloom

Maintenance Mode - Build, deploy and manage archives and their metadata in S3 and SimpleDB.
Ruby
15
star
81

naavik

Go
15
star
82

semantic-release-slack

A plugin for semantic-release that takes a Slack web hook and posts a message when a release is successful
JavaScript
14
star
83

cfn-deploy

A useful GitHub Action to help you deploy cloudformation templates
Shell
14
star
84

dse-pronto

Pronto is an automation suite for deploying and managing DataStax Cassandra clusters in AWS.
Shell
14
star
85

go-loadgen

go-loadgen is a log infrastructure testing tool. Also suitable for load testing big data pipelines
Go
13
star
86

standardly

Standardly allows you to check for compliance against standards. Once you code your standards into a 'rules' json object, you can scan a directory on your filesystem or a GitHub repo to check for its compliance against the standard.
JavaScript
13
star
87

graphql-orchestrator-java

GraphQL Orchestrator stitches the schemas from multiple micro-services and orchestrates the graphql queries to these services accurately at runtime
Groovy
12
star
88

spring-pulsar

Spring client library for apache pulsar allows consuming applications to integrate easily with apache pulsar.
Kotlin
12
star
89

unmazedboot

🐳 Generic SpringBoot Docker files and image management 🍃
Dockerfile
12
star
90

scss-cleanup-scripts

Shell scripts for removing redundant Sass files, variables, mixins and deleting unused images
Shell
12
star
91

apollo-mock-http

An easy and maintainable way of injecting mock data into Apollo GraphQL Client for fast feature development decoupled from API/Backend.
JavaScript
11
star
92

spring-config-client-fallback

Spring Cloud Config Client with Fallback implementation for cases when the the config server is down
Java
11
star
93

Autumn

Micro-services injectable infrastructure project. Autumn enables rapid development of mico-service applications.
Java
11
star
94

sdbport

Maintenance Mode - Import / Export SimpleDB Domains.
Ruby
11
star
95

cfn-clone

CLI to clone cloud formation stacks
Go
10
star
96

lean-schema

Shrink your large GraphQL Schema to only what you need with Intuit LeanSchema!
Python
10
star
97

swift-hooks

A little module for plugins, in swift.
Swift
10
star
98

thrive

Thrive is an ETL framework that runs single-row transformations on HDFS data and makes the data available in relational databases (Hive and Vertica).
Python
10
star
99

perfsizesagemaker

perfsizesagemaker is a tool that uses automated performance testing to determine the right size of infrastructure for hosting models on AWS SageMaker.
HTML
9
star
100

datum-ipsum

Java-based library to statistically characterize and randomly generate strings.
Java
9
star