PuzzleAnimation 1.1.1

PuzzleAnimation 1.1.1

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布上次发布2016年6月
SPM支持SPM

Anton Domashnev维护。



  • 作者
  • Anton Domashnev

ADPuzzleAnimation

codebeat badge

内容包含

受到Fabric - Answers动画启发的专门为UIView自定义的动画。

易于使用

要创建第一个动画,您只需要了解一个方法

/**
 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())

它很灵活 - 您可以配置动画的几乎所有参数

/**
 *  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
}

处理有关状态的回调以启动新动画或执行其他操作

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

直观且简单的接口

/**
 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()

完整示例请查看viewController.swift

易于安装