A fantastic Physical animation library for swift

Last update: Jun 14, 2022

Carthage compatible Packagist codebeat badge Travis branch Cocoapods badge

A fantastic Physical animation library for swift(Not Just Spring !!!), it is base on UIDynamic and extension to it, friendly APIs make you use it or custom your own animation very easily!

Support

Integration

Cocoapods(iOS 8+)

  • You can use Cocoapods to install Stellar by adding it to your Podfile:
platform :ios, '8.0'
use_frameworks!

target 'YourApp' do
    pod 'Stellar', :git => 'https://github.com/AugustRush/Stellar.git'
end

Carthage (iOS 8+)

  • You can use Carthage to install Stellar by adding it to your Cartfile:
github "AugustRush/Stellar"

Manually (iOS 8+)

To use this library in your project manually you may:

  • for Projects, just drag Stellar Sources to the project tree
  • for Workspaces, include the whole StellarDemo.xcodeproj

Features

- View's Animation
- Layer's Animation
- Chainable (every step can be observed)
- File configurable (come soon)

Animations

- Basic
- Gravity
- Snap
- Attachment
- Push
- Collsion(come soon)

Animatable type

- Float
- CGFloat
- Double
- CGSize
- CGPoint
- CGRect
- UIColor
- ......(Any Intrpolatable)

Easing Curve (Base Animation)

- Default
- EaseIn
- EaseOut
- EaseInEaseOut
- Linear
- SwiftOut
- BackEaseIn
- BackEaseOut
- BackEaseInOut
- BounceOut
- Sine
- Circ
- ExponentialIn
- ExponentialOut
- ElasticIn
- ElasticOut
- BounceReverse
- Custom(Double, Double, Double, Double)

On display

Funny demo's gif(s)

Chainable

  1. Common

for (index,line) in leftLines.enumerate() {
    let delay = Double(index) * 0.2
    
    line.moveX(200).duration(2).easing(.SwiftOut).delay(delay)
        .then().moveX(-200).rotateY(1.43).easing(.SwiftOut)
        .makeColor(UIColor.greenColor()).repeatCount(100)
        .autoreverses().duration(2).animate()
 }
        
 for (index,line) in rightLines.enumerate() {
    let delay = Double(index) * 0.2
    
    line.moveX(-200).duration(2).easing(.SwiftOut).delay(delay)
        .then().moveX(200).rotateY(1.43).easing(.SwiftOut)
        .makeColor(UIColor.purpleColor()).repeatCount(100)
        .autoreverses().duration(2).animate()
 }
  1. every step completion observable

animateView.makeSize(CGSizeMake(50, 150)).snap(0.3).completion({
                print("First step")
            })
            .then().moveX(-100).moveY(-50).anchorPoint(CGPointMake(1, 1)).duration(1).completion({
                print("Second step!")
            })
            .then().rotate(CGFloat(M_PI)).attachment(0.3, frequency: 0.8).completion({
                print("Third step!")
            })
            .then().moveY(500).completion({
                print("last step, all completion")
            })
            .animate()

Snap Curve

Attachment Curve

Gravity Curve

Push Curve

Basic Curve

To do

- File configurable
- Easily Interactive Animations
- Collision
- Mutilple View/Layer performance
- More demos

Licence

Copyright (c) 2016 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

GitHub

https://github.com/AugustRush/Stellar
Comments
  • 1. How to "glue" animation

    I want to design an animation by chaining several animations in a programmatically way.

    I tried the following without success:

    aView = aView.moveX(5.0).duration(2.0).completion({ do_something() }).then()
    ...
    aView = aView.moveX(7.0).duration(1.0).completion({ do_something() }).then()
    
    aView.animate()
    

    How to achieve this?

    Reviewed by ghost at 2017-04-18 17:49
  • 2. Swift 3 errors

    I love Stellar. Animations with Swift like they should be. Thanks. but... Swift 3 branch seems to throw compile errors. Any plans on fixing this? Swift 3 officially out today. thanks.

    Reviewed by TanelTeemusk at 2016-09-14 13:32
  • 3. Carthage

    Reviewed by TofPlay at 2016-06-06 05:15
  • 4. scaleXY doesn't work as expected

    Unless the library works differently it is ususally expected that a scale of 1 always return the identity matrix scalling column back.

    However here with Stellar (and thanks for you great work btw), this not the case. A simple exemple with

    myView.scaleXY(0.9,0.9).animate()
    // later on: 
    myView.scaleXY(1.0,1.0).animate()
    

    shows that the scaling factor of 1.0 leave the scale of the view unchanged. And changing the second call to myView.scaleXY(1.1,1.1).animate() doesn't return the view to its original scale either (that, I have trouble understanding).

    If you have any question regarding this, let me know :)

    Reviewed by apouche at 2016-06-23 15:32
  • 5. When I use OC, import the swift code, found that there is no easing and other methods

     @interface CALayer (SWIFT_EXTENSION(Stellar)) @end

    @interface UIColor (SWIFT_EXTENSION(Stellar))

    • (void)fallTo:(UIColor * _Nonnull)to magnitude:(double)magnitude render:(void (^ _Nonnull)(UIColor * _Nonnull))render completion:(void (^ _Nullable)(void))completion;
    • (void)snapTo:(UIColor * _Nonnull)to damping:(CGFloat)damping render:(void (^ _Nonnull)(UIColor * _Nonnull))render completion:(void (^ _Nullable)(void))completion;
    • (void)attachmentTo:(UIColor * _Nonnull)to damping:(CGFloat)damping frequency:(CGFloat)frequency render:(void (^ _Nonnull)(UIColor * _Nonnull))render completion:(void (^ _Nullable)(void))completion;
    • (void)pushedTo:(UIColor * _Nonnull)to render:(void (^ _Nonnull)(UIColor * _Nonnull))render completion:(void (^ _Nullable)(void))completion; @end

    @interface UIDynamicBehavior (SWIFT_EXTENSION(Stellar)) @end

    @class UIView;

    @interface UILabel (SWIFT_EXTENSION(Stellar))

    • (UIView * _Nonnull)makeTextColor:(UIColor * _Nonnull)color; @end

    @interface UITextView (SWIFT_EXTENSION(Stellar))

    • (UIView * _Nonnull)makeTextColor:(UIColor * _Nonnull)color; @end

    @interface UIView (SWIFT_EXTENSION(Stellar))

    • (BOOL)configureWithJSON:(NSString * _Nonnull)str error:(NSError * _Nullable * _Null_unspecified)error; @end

    @interface UIView (SWIFT_EXTENSION(Stellar))

    • (UIView * _Nonnull)moveX:(CGFloat)increment;
    • (UIView * _Nonnull)moveY:(CGFloat)increment;
    • (UIView * _Nonnull)moveTo:(CGPoint)point;
    • (UIView * _Nonnull)makeColor:(UIColor * _Nonnull)color;
    • (UIView * _Nonnull)makeAlpha:(CGFloat)alpha;
    • (UIView * _Nonnull)rotate:(CGFloat)z;
    • (UIView * _Nonnull)rotateX:(CGFloat)x;
    • (UIView * _Nonnull)rotateY:(CGFloat)y;
    • (UIView * _Nonnull)rotateXY:(CGFloat)xy;
    • (UIView * _Nonnull)makeWidth:(CGFloat)width;
    • (UIView * _Nonnull)makeHeight:(CGFloat)height;
    • (UIView * _Nonnull)makeSize:(CGSize)size;
    • (UIView * _Nonnull)makeFrame:(CGRect)frame;
    • (UIView * _Nonnull)makeBounds:(CGRect)bounds;
    • (UIView * _Nonnull)scaleX:(CGFloat)x;
    • (UIView * _Nonnull)scaleY:(CGFloat)y;
    • (UIView * _Nonnull)scaleXY:(CGFloat)x :(CGFloat)y;
    • (UIView * _Nonnull)cornerRadius:(CGFloat)radius;
    • (UIView * _Nonnull)borderWidth:(CGFloat)width;
    • (UIView * _Nonnull)shadowRadius:(CGFloat)radius;
    • (UIView * _Nonnull)zPosition:(CGFloat)position;
    • (UIView * _Nonnull)anchorPoint:(CGPoint)point;
    • (UIView * _Nonnull)anchorPointZ:(CGFloat)z;
    • (UIView * _Nonnull)shadowOffset:(CGSize)offset;
    • (UIView * _Nonnull)shadowColor:(UIColor * _Nonnull)color;
    • (UIView * _Nonnull)shadowOpacity:(float)opacity;
    • (UIView * _Nonnull)makeTintColor:(UIColor * _Nonnull)color;
    • (UIView * _Nonnull)completion:(void (^ _Nonnull)(void))c;
    • (UIView * _Nonnull)then;
    • (UIView * _Nonnull)then;
    • (void)animate;
    • (void)cancelAllRemaining; @end
    Reviewed by HellojingQiu at 2016-06-12 08:17
  • 6. Rename autoreverses to reverses (Support Swift 4)

    Previous function name conflicted with something ObjC.

    Method 'autoreverses()' with Objective-C selector 'autoreverses' conflicts with getter for 'autoreverses' with the same Objective-C selector

    Reviewed by mikker at 2017-08-31 09:40
  • 7. Does it work with autolayout ?

    Hi, I have just got an issue when I try to animate the appearance of a view by extending its width from 0 to full width, from left to right.

    view.makeFrame(CGRect(origin: origin, size: CGSize(width: 0, height: view.bounds.height))).makeAlpha(1).duration(0).then()
                .makeFrame(CGRect(origin: origin, size: CGSize(width: width, height: view.bounds.height))).duration(1).animate()
    

    The view is expected to extend from the origin of the view.

                |                                                   |               
                |----->-------------->-----------------------------
                |                                                   |  
                |                                                   |  
                |                                                   | 
    

    (view left border) (view right border)

    However, it did extend from the center of the view.

                |                                                   |               
                |                           ---->------------->---------------------------
                |                                                   |  
                |                                                   |  
                |                                                   |  
    

    In the storyboard, autolayout of this view is set as having 0 padding to the left border of the container.

    Reviewed by jibeex at 2016-08-04 14:47
  • 8. makeAlpha seems not working

    Hi,

    Seems that makeAlpha is not working, or maybe I'm doing something wrong. Can you add an example of how to use it on the demo view controllers?

    Thanks

    Reviewed by P0nj4 at 2016-06-09 13:18
  • 9. Unable into install via CocoaPods

    I've noticed there's a podspec file available but some for strange reason I can't find the repo on CocoaPods.

    pod 'Stellar'
    

    Returns a Unable to find a specification for Stellar error.

    Although downloading straight from the source works.

    pod 'Stellar', :git=>'https://github.com/AugustRush/Stellar.git'
    
    Reviewed by gkye at 2016-06-07 22:06
  • 10. Correct the spelling of CocoaPods in README

    This pull request corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    Created with cocoapods-readme.

    Reviewed by ReadmeCritic at 2016-06-12 03:49
  • 11. Stellar does not play well with Carthage

    For months now I have problem using Stellar with Carthage. I have to ways to solve the problems: 1/ by "manually" building Stellar framework after changing stuff in Xcode project or 2/ by adding sources to my project. But as for now the last option does not work because the code imported using Carthage is not the last one on GitHub...

    So there is definitely something wrong with Carthage.

    Reviewed by ghost at 2017-10-22 09:27
  • 12. "Unsupport this animation type!" exception

    With 0.66 this exception is thrown on very basic animation:

    myView.makeAlpha(0.0)
          .duration(aDuration)
          .autoreverses()
          .repeatCount(someRepetitions)
          .completion {
                // Some statements
                  myView.removeFromSuperview()
                }
          .animate()
    

    Let's say it's a find of flash.

    I tried other animation like makeSizeor makeColor but same behavior.

    This flash portion of code is called several times on a sequence basis. On the first call everything is fine. The exception is raises on the second call.
    Between these two calls of flash there is an animation using CATransaction. On the completion block of this animation the second call of flash is then made.

    CATransaction.begin()
    CATransaction.setCompletionBlock({
          // call to flash animations
    })
    
    ...
    
    CATransaction.commit()
    

    This error came after I decided to use CATransaction to use it's completion block.

    Reviewed by ghost at 2017-08-17 05:36
  • 13. Update library in Cocoapods

    Hi,

    Interesting library!

    Latest release here is 0.66, while on pods you can only find 0.61. Any reason to keep it that way? Could you update it there too? So we don't need to point this specific branch.

    Thank you, H.

    Reviewed by hernangonzalez at 2017-05-19 19:52
  • 14. Using makeAlpha on 0.66 generates crash

    Using makeAlpha of 0.66 generates the Unsupport this animation type! (btw, Unsupport is not word ... Do not support this animation type! is better)

    Reverting back to 0.65 fixed the issue by using the following in the Podfile pod 'Stellar', :git => 'https://github.com/AugustRush/Stellar', :commit => '5249167900b1eb136ce71543af7817a9fa5535cb'

    Reviewed by ShaharHD at 2017-05-13 06:35
  • 15. "has no member" error

    I want to use Stellar with my project but I have this Value of type 'UIView' has no member error in my very first attempt to use Stellar on an UIView.

    I use Carthage to install Stellar the same way as other libraries. It's like Stellar is not "installed". Installation using Stellar 0.65 is OK, and the usual Carthage installation has been followed. Then, I used the direct inclusion of Sourcesdirectory and everything is fine.

    I have clean project. This is a weird behavior... Any idea? Is there special configuration for Carthage command?

    Reviewed by ghost at 2017-04-03 16:31
SwiftUI-Text-Animation-Library - Text animation library for SwiftUI
SwiftUI-Text-Animation-Library - Text animation library for SwiftUI

⚠️ This repository is under construction. SwiftUI Text Animation Library Make yo

May 23, 2022
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 /

Jun 19, 2022
An experiment for using SwiftUI's custom timing Animation to create an orbital-like animation.
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

Apr 3, 2022
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks

SwiftUI Animation Observer Track SwiftUI animation progress and completion via c

Jun 13, 2022
A powerful, elegant, and modular animation library for Swift.
A powerful, elegant, and modular animation library for Swift.

MotionMachine provides a modular, powerful, and generic platform for manipulating values, whether that be animating UI elements or interpolating prope

May 30, 2022
Swift animation library for iOS, tvOS and macOS.
Swift animation library for iOS, tvOS and macOS.

anim is an animation library written in Swift with a simple, declarative API in mind. // moves box to 100,100 with default settings anim { self.bo

May 24, 2022
Animation library for iOS in Swift
Animation library for iOS in Swift

TweenKit TweenKit is a powerful animation library that allows you to animate (or 'tween') anything. TweenKit's animations are also scrubbable, perfect

Jun 17, 2022
Easy animation library on iOS with Swift2
Easy animation library on iOS with Swift2

Cheetah Cheetah is an animation utility on iOS with Swift. Cheetah can animate any properties since Cheetah uses simple CADisplayLink run loop to chan

Apr 25, 2022
A radical & elegant animation library for iOS.
A radical & elegant animation library for iOS.

Installation • Usage • Debugging • Animatable Properties • License Dance is a powerful and straightforward animation framework built upon the new UIVi

Jun 14, 2022
An extensible iOS and OS X animation library, useful for physics-based interactions.
An extensible iOS and OS X animation library, useful for physics-based interactions.

Pop is an extensible animation engine for iOS, tvOS, and OS X. In addition to basic static animations, it supports spring and decay dynamic animations

Jun 28, 2022
An Objective-C animation library used to create floating image views.
An Objective-C animation library used to create floating image views.

JRMFloatingAnimation [![CI Status](http://img.shields.io/travis/Caroline Harrison/JRMFloatingAnimation.svg?style=flat)](https://travis-ci.org/Caroline

Apr 15, 2022
Anima is chainable Layer-Based Animation library for Swift5.
Anima is chainable Layer-Based Animation library for Swift5.

Anima Anima is chainable Layer-Based Animation library for Swift5. It support to make sequensial and grouped animation more easily. is written as foll

Feb 28, 2022
Lightweight animation library for UIKit
Lightweight animation library for UIKit

MotionAnimation Lightweight animation library for UIKit in Swift Checkout the Examples folder for more. Consider MotionAnimation as a extremely simpli

May 28, 2022
This library is for adding animation to iOS tabbar items, which is inherited from UITabBarController.
This library is for adding animation to iOS tabbar items, which is inherited from UITabBarController.

This library is for adding animation to iOS tabbar items, which is inherited from UITabBarController. Installation Just add the Sources folder to your

Jun 18, 2022
A DSL to make animation easy on iOS with Swift.
A DSL to make animation easy on iOS with Swift.

This project is highly inspired by JHChainableAnimations, If you project is developed with Objective-C, use JHChainableAnimations instead. With DKChai

Apr 18, 2022
Elegant SVG animation kit for swift
Elegant SVG animation kit for swift

Elephant This is SVG animation presentation kit for iOS. Example You can run example app. Please open Example-iOS/Elephant-iOS.xcworkspace! Usage You

May 25, 2022
Gemini is rich scroll based animation framework for iOS, written in Swift.
Gemini is rich scroll based animation framework for iOS, written in Swift.

Overview What is the Gemini? Gemini is rich scroll based animation framework for iOS, written in Swift. You can easily use GeminiCollectionView, which

Jun 23, 2022
Pulse animation for iOS written with Swift.
Pulse animation for iOS written with Swift.

Pulsator Pulse animation for iOS written with Swift. Great For: Pulses of Bluetooth, BLE, beacons (iBeacon), etc. Map Annotations Installation CocoaPo

Jun 17, 2022
Swift animation made easy
Swift animation made easy

Fluent Swift Animations made Easy Installation Add the following to your Podfile and run pod install pod 'Fluent', '~> 0.1' or add the following

Feb 11, 2022