A collection of animations for iOS. Simple, just add water animations.

Overview

DCAnimationKit

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

Examples

All our examples will use this as a base.

self.moveLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 85, 200, 100)];
self.moveLabel.backgroundColor = [UIColor clearColor];
self.moveLabel.text = NSLocalizedString(@"Animate!", nil);
self.moveLabel.font = [UIFont systemFontOfSize:36];
[self.moveLabel sizeToFit];
[self.view addSubview:self.moveLabel];

self.moveView = [[UIView alloc] initWithFrame:CGRectMake(40, 165, 200, 100)];
self.moveView.backgroundColor = [UIColor orangeColor];
[self.view addSubview:self.moveView];

Attention getters

Tada

alt tag

our method to run tada.

[self.moveView tada:NULL];
[self.moveLabel tada:NULL];

Bounce

alt tag

our method to run bounce.

[self.moveView bounce:NULL];
[self.moveLabel bounce:NULL];

Pulse

alt tag

our method to run pulse.

[self.moveView pulse:NULL];
[self.moveLabel pulse:NULL];

Shake

alt tag

our method to run shake.

[self.moveView shake:NULL];
[self.moveLabel shake:NULL];

Swing

alt tag

our method to run swing.

[self.moveView swing:NULL];
[self.moveLabel swing:NULL];

Intros

Intros have a slight difference from the base code. We simple remove these 2 lines:

//[self.view addSubview:self.moveLabel];
//[self.view addSubview:self.moveView];

This lines will be added to the view once they snap in.

Snap

alt tag

our method to run the snap in.

[self.moveLabel snapIntoView:self.view direction:DCAnimationDirectionTop];
[self.moveView snapIntoView:self.view direction:DCAnimationDirectionLeft];

Bounce

alt tag

our method to run the bounce in.

[self.moveLabel bounceIntoView:self.view direction:DCAnimationDirectionTop];
[self.moveView bounceIntoView:self.view direction:DCAnimationDirectionLeft];

Expand

alt tag

our method to run the expand.

[self.moveLabel expandIntoView:self.view finished:NULL];
[self.moveView expandIntoView:self.view finished:NULL];

Outros

Compress

alt tag

our method to run the compress.

[self.moveLabel expandIntoView:NULL];
[self.moveView expandIntoView:NULL];

Hinge

alt tag

our method to run the hinge.

[self.moveLabel hinge:NULL];
[self.moveView hinge:NULL];

Drop

alt tag

our method to run the drop.

[self.moveLabel drop:NULL];
[self.moveView drop:NULL];

General transitions

To round off our fantastic animations, DCAnimationKit also simplifies doing ordinary frame manipulation.

UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(40, 85, 50, 50)];
baseView.backgroundColor = [UIColor grayColor];
[self.view addSubview:baseView];

self.moveView = [[UIView alloc] initWithFrame:baseView.frame];
self.moveView.backgroundColor = [UIColor redColor];
[self.view addSubview:self.moveView];

Move

alt tag

our code to move around.

CGFloat distance = 80;
__weak id weakSelf = self.moveView;
[weakSelf moveX:distance finished:^{
    [weakSelf moveY:distance finished:^{
        [weakSelf moveX:-distance finished:^{
            [weakSelf moveY:-distance finished:^{

            }];
        }];
    }];
}];

We can also set the view's origin to a specific value as well.

__weak id weakSelf = self.moveView;
[weakSelf setX:200 finished:^{
    [weakSelf setY:200 finished:^{
        [weakSelf setX:40 finished:^{
            [weakSelf setY:85 finished:^{

            }];
        }];
    }];
}];

We can even slide to a specific point (there is a move as well!).

[self.moveView movePoint:CGPointMake(100, 100) finished:NULL];

Rotation

alt tag

our code to rotate (there is a move rotation as well).

__weak id weakSelf = self.moveView;
[weakSelf setRotation:45 duration:.35 finished:^{
    [weakSelf setRotation:0 duration:.35 finished:^{

    }];
}];

Install

The recommended approach for installing DCAnimationKit is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation.

via CocoaPods

Install CocoaPods if not already available:

$ [sudo] gem install cocoapods
$ pod setup

Change to the directory of your Xcode project, and Create and Edit your Podfile and add DCAnimationKit:

$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
platform :ios, '7.0'
pod 'DCAnimationKit'

Install into your project:

$ pod install

Open your project in Xcode from the .xcworkspace file (not the usual project file)

Requirements

DCAnimationKit requires at least iOS 7 or above.

License

DCAnimationKit is license under the Apache License.

Contact

Dalton Cherry

You might also like...
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.

SamuraiTransiton is a ViewController transition framework in Swift. It is an animation as if Samurai cut out the screen with a sword. transition types

SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image

SwiftUI.AnimatedImage SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image Screen.Recording.2021-07-31.at.02.18.33.mov Insta

ViewAnimator brings your UI to life with just one line
ViewAnimator brings your UI to life with just one line

ViewAnimator is a library for building complex iOS UIView animations in an easy way. It provides one line animations for any view included the ones wh

An easy way to add a simple, shimmering effect to any view in an iOS app.
An easy way to add a simple, shimmering effect to any view in an iOS app.

Shimmer Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator. Shimmer was origin

Gravity is a simple Swift Package Manager to add gravity to UI objects easily.
Gravity is a simple Swift Package Manager to add gravity to UI objects easily.

Gravity -- Gravity is a simple Swift Package to add gravity to UI objects easily. -- How to use: Add a new Swift Package from XCode and paste the url

Advanced Natural Motion Animations, Simple Blocks Based Syntax
Advanced Natural Motion Animations, Simple Blocks Based Syntax

FlightAnimator Moved to Swift 3.1 Support: For Swift 3.1 - Use tag Version 0.9.9 See Installation Instructions for clarification Introduction FlightAn

DaisyChain is a micro framework which makes UIView animations chaining dead simple.

DaisyChain DaisyChain is a micro framework which makes UIView animations chaining dead simple. It uses the exact same interface you are familiars with

Designed for gesture-driven animations. Fast, simple, & extensible!
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

Simple UIButton subclass with additional state change animations (e.g. backgroundColor) and missing features
Simple UIButton subclass with additional state change animations (e.g. backgroundColor) and missing features

SimpleButton UIButton subclass with animated, state-aware attributes. Easy to subclass and configure! Full API docs Usage Just create your own SimpleB

Comments
  • How implement animation in UITableView or UICollectionView?

    How implement animation in UITableView or UICollectionView?

    Suppose I am using tableview in Xcode project. I made on custom cell. In that, I have 1 image view and 1 label, like following:

    `- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; cell.lblName.text = arrIndexes[indexPath.row]; NSInteger num = [[arrIndexes objectAtIndex:indexPath.row] integerValue]; cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%ld.png",(long)num]];`

    //Then I use DCAnimation like this [cell.imageView bounceIntoView:cell direction:DCAnimationDirectionLeft];

    }`

    It is not working properly...

    opened by milanivarni 1
Owner
Dalton
Developer. Disciple. Computer science aficionado. Mobile enthusiast. Drum machine. Rock climbing extraordinaire. The next American Ninja Warrior.
Dalton
Simple calculation to render cheap water effects.

Water Simple calculation to render cheap water effects. This simple project demonstrates : how to use Metal draw compute shader, or known as 'kernal f

Xue Yu 381 Sep 20, 2022
Simple water drops animation 💧

WaterDrops Simple water drops animation ?? Example override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = U

Oh Hyungjun 403 Nov 10, 2022
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Jogendra 1.4k Jan 6, 2023
Water Ripple Animation Demonstration

WaterRippleAnimationDemonstration Water Ripple Animation Demonstration From the

AndyLan 2 Apr 5, 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
MotionBlur allows you to add motion blur effect to iOS animations.

MotionBlur MotionBlur allows you to add motion blur effect to your animations (currently only position's change). See the accompanying blog post to le

Arek Holko 1.5k Nov 3, 2022
This repo contains swift collection of gui, games, menu, animations, music, payment, etc... for iOS, macOS, watchOS and tvOS

Swift-Collections About: This repo contains a collection of projects built using swift and objective-c Contains projects for macOS iOS iPad watchOS tv

Krisna Pranav 6 Nov 15, 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
(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