Code Monkey home page Code Monkey logo

adpuzzleanimation's Introduction

ADPuzzleAnimation

CocoaPods Compatible Carthage compatible codebeat badge

Whats inside

Custom animation for UIView inspired by Fabric - Answers animation.

Easy to use

To create your first animation you need to know only about one method:

/**
 Designated initializer for puzzle animation and it's subclasses
 
 - parameter viewToAnimate: view to render into pieces
 - parameter configuration: animation configuration
 
 - returns: newly created animation instance
 */
init(viewToAnimate: UIView, configuration: PuzzleAnimationConfiguration = PuzzleAnimationConfiguration())

It's flixible - you can configure almost any parameter for the animation:

/**
 *  Defines the structure that contains configurable parameters for puzzle animation
*/
struct PuzzleAnimationConfiguration {

  /// Defines the animation velocity. Higher velocity less animation duration
  var animationVelocity: NSTimeInterval = 1

  /// Defines the delay between each piece in piece's group animation
  var pieceAnimationDelay: PuzzleAnimationDelay = defaultForwardPieceAnimationDelay

  /// Defines the delay between each group of pieces animation
  var pieceGroupAnimationDelay: PuzzleAnimationDelay = defaultForwardPieceGroupAnimationDelay

  /// Defines the animation piece's scale
  var animationScale: Double = 2.5

  /// Each piece represents square and this value represents the number of pixels of square side
  var pieceSide: CGFloat = 40
}

Handle callbacks about status to start new animation or do something else:

/// Called when animation completed, stoped or failed
/// @note You can set it any time even during the animation
public var animationCompletion: PuzzleAnimationCompletion?

Intuitive and simple interface:

/**
 Starts the animation. Makes view to animate hidden
*/
public func start()
    
/**
 Stops the animation. Removes all pieces from superview. Makes view to animate visible
 */
public func stop()

For the complete example check the viewController.swift

Easy to install

CocoaPods

To integrate ADPuzzleAnimation into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'PuzzleAnimation', '~> 1.1.1'

Carthage

To integrate ADPuzzleAnimation into your Xcode project using Carthage, specify it in your Cartfile:

github "Antondomashnev/ADPuzzleAnimation" ~> 1.1.1

Run carthage update to build the framework and drag the built ADPuzzleAnimation.framework into your Xcode project.

adpuzzleanimation's People

Contributors

antondomashnev avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.