A fantastic Physical animation library for swift

Overview

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.
Comments
  • How to

    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?

    opened by ghost 6
  • Swift 3 errors

    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.

    bug 
    opened by TanelTeemusk 3
  • Carthage

    Carthage

    opened by TofPlay 3
  • scaleXY doesn't work as expected

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

    opened by apouche 2
  • When I use OC, import the swift code, found that there is no easing and other methods

    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
    opened by HellojingQiu 2
  • Rename autoreverses to reverses (Support Swift 4)

    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

    opened by mikker 1
  • Does it work with autolayout ?

    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.

    opened by jibeex 1
  • makeAlpha seems not working

    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

    opened by P0nj4 1
  • Unable into install via CocoaPods

    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'
    
    opened by gkye 1
  • Correct the spelling of CocoaPods in README

    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.

    opened by ReadmeCritic 0
  • Stellar does not play well with Carthage

    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.

    opened by ghost 0
  • "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.

    opened by ghost 9
  • Update library in Cocoapods

    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.

    opened by hernangonzalez 0
  • Using makeAlpha on 0.66 generates crash

    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'

    opened by ShaharHD 2
  • "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?

    bug 
    opened by ghost 12
Owner
August
###
August
SwiftUI-Text-Animation-Library - Text animation library for SwiftUI

āš ļø This repository is under construction. SwiftUI Text Animation Library Make yo

null 28 Jan 8, 2023
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 /

CATS Open Source Softwares 1k Nov 10, 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
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
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

Brett Walker 387 Dec 9, 2022
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

Onur Ersel 555 Dec 12, 2022
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

Steve Barnegren 1.3k Dec 18, 2022
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

Suguru Namura 592 Dec 6, 2022
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

Saoud Rizwan 648 Dec 14, 2022
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

Meta Archive 19.8k Dec 28, 2022
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

Caroline Harrison 233 Dec 28, 2022
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

Satoshi Nagasaka 528 Dec 27, 2022
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

Luke Zhao 145 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. Installation Just add the Sources folder to your

Yuşa Doğru 162 Jan 6, 2023
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

Draven 1.9k Dec 9, 2022
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

Kazumasa Shimomura 127 Dec 14, 2022
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

Shohei Yokoyama 3k Dec 27, 2022
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

Shuichi Tsutsumi 1.3k Jan 6, 2023
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

Matthew Cheok 300 Jul 15, 2022