rezumat

AXAnimationChain 是 一个 ** 链式 动画 库, 可以 用来 轻松 的 创建 基于 CAAnimation 的 链式 动画。的 组合 方式 有 两种 , 一种 是组合 ** , 另 一种 则 是链接, 通过 以上 两种 方式创建 的 动画 , 既 可以 同时 进行 , 也 可以 按 时间 先后 进行 , 可以 使用 的 的 代码 出 出 丰富 复杂 的 动画 效果 :

简单 使用:

_transitionView.spring.centerBy (CGPointMake (0, 100)). easeOut.spring.sizeBy (CGSizeMake (100, 100)). spring.cornerRadiusBy (4) .animate ();

高级 使用:

_transitionView.chainAnimator.basic.target (self) .complete (@selector (complete :)). property (@ “position”). toValue ([NSValue valueWithCGPoint: CGPointMake (100, self.view.center.y)]). easyInBack.duration (0.5) .combineSpring.target (self) .complete (@selector (complete :)). property (@ “limits”). toValue ([NSValue valueWithCGRect: CGRectMake (0, 0, 100, 100)]) .duration (0.5) .repeatCount (5) .autoreverses.combineSpring.target (self) .complete (@selector (complete :)). property (@ “transform.rotation”). toValue (@ (M_PI_4)). duration ( 0.5) .repeatCount (3) .beginTime (1.0) .autoreverses.nextToBasic.property (@ “position”). ToValue ([NSValue valueWithCGPoint: self.view.center]). Duration (0.5) .combineSpring.property (@ ” limite “). toValue ([NSValue valueWithCGRect: CGRectMake (0, 0, 100, 100)]). durata (0,8) .nextToBasic.property (@” transform.rotatie “).

follada real coños calientes
videos porno peruano fiestas porno
follate a mi novia porno tv
porno en cine convencional porni
porno trans amas de casa follando
cine para adultos gratis pornox
miriam sanchez videos porno española follando
peliculas eroticas gratis en español porno fiestas
maduritas cachondas incesto x
abuela porno largeporntube
videos porno casero españa tias corriendose
videos eroticos italianos todoporno
casadas muy putas pilladas desnudas
folladas extremas madresxxx
follada en tanga maduras folladoras
maduras peludas españolas maduras en la playa
incesto subtitulado español mujer masturbandose
follar abuelas masturbaciones
gordibuenas españolas p0rno
porno gratis anal michelle jenner desnuda

toValue (@ (M_PI_4)). durata (1.0) .completeWithBlock (zero) .animate ();

看起来比较冗余,但是细读会发现,就只有其实一行代码.

链接组合在 协议 AXAnimatorChainDelegate 中 进行 定义 , 分别 是 : nextTo: 和 combineWith: , 在 使用 的 过程 中 应当 予以 区分.

AXAnimationChain 基于 CoreAnimation 定义 了 几种 Animator , AXChainAnimator 是 基 类 , 预定 义 了 一系列 Animate 操作 , 可以链接组合并且 控制 动画 完成 的回调

AXChainAnimator –AXBasicChainAnimator == CABasicAnimation –AXSpringChainAnimator == CASpringAnimation –AXKeyframeChainAnimator == CAKeyframeAnimation –AXTransitionChainAnimator == CATransitionAnimation

Chiar langa

通过 链接 的 方式 处理 两个 animator ,被 链接的 animator 将会 在 前者 动画 (包含 * 组合 * 的 动画) 完成 之后 进行 动画, 大概 的 示例 如下 :

Next-To 方法 的 原型 如下 :

– (instancetype) nextTo: (id <AXAnimatorChainDelegate>) animator;

当 向 fost aniamtor 发送 nextTo: 消息 之后 , 返回 的 是 nexter animator 作为 下次链接或者组合 操作的 对象 , 因此 AXAnimationChain 定义 了 几种 常用 的 操作 :

/// 链接 到 Basic 动画 并且 返回 链接 的 Basic 动画. – (AXBasicChainAnimator *) nextToBasic; /// 链接 到 Spring 动画 并且 放回 链接 的 Spring 动画. – (AXSpringChainAnimator *) nextToSpring; /// 链接 到 Keyframe 动画 并且 放回 链接 的 Keyframe 动画. – (AXKeyframeChainAnimator *) nextToKeyframe; /// 链接 到 Tranzitie 动画 并且 返回 链接 的 Tranzitie 动画. – (AXTransitionChainAnimator *) nextToTransition;

在 发送 消息 之后 分别 返回 对应 类型 的可操作 对象.

Combina cu

通过 组合 的 方式 处理 两个 animator , 被 组合 的 animator 将会 与 前者 动画 同时 进行 , 完成 的 时间 以 时间 最长 的 为准, 示例 如下 :

[fost combineWith: combinator];

Combinati-cu 方法 原型 如下 :

– (instancetype) combineWith: (nonnull AXChainAnimator *) animator;

当 向 fost animator 发送 combineWith: 消息 之后 , 返回 的 是 combinator animator 作为 下次链接或者组合 操作的 对象 , 在 AXAnimationChain 中 , 默认 一下 几种 组合 方式 :

/// 组合 到 Basic 动画 并且 返回 组合 的 Basic 动画. – (AXBasicChainAnimator *) combineBasic; /// 组合 到 Spring 动画 并且 放回 组合 的 Spring 动画. – (AXSpringChainAnimator *) combineSpring; /// 组合 到 Keyframe 动画 并且 放回 组合 的 Keyframe 动画. – (AXKeyframeChainAnimator *) combineKeyframe; /// 组合 到 Tranzitie 动画 并且 返回 组合 的 Tranzitie 动画. – (AXTransitionChainAnimator *) combineTransition;

同样 的 , 在 向 某一 操作 对象 animator 发送 以上 消息 之后 , 将会 分别 返回 对应 类型 的可操作 对象.

Relatie

在 AXAnimationChain 中 , 关系 的 管理 采用 的 是 二叉树 的 理论. 某 一个 animator 对应 的 类 结构 中 , 包含 了 指向父 节点的 superAnimator 用于 表示 父 animator, 表示 此 animator 为 superAnimator 所 链接 的 animator, 此时 , superAnimator 的 childAnimator 即 指向 此 animator作为一个闭环 链 链将关系 锁定 起来; 同样 的 , 某 一个 animator 还 拥有 一个 指向 兄弟节点的 NSArray <AXChainAnimator *> 结构: combineAnimators 用于 管理所 组合 的 animators , 并且 , 被 组合 的 animator 的 父 节点 superAnimator 则 指向 当前 animator.

– (nul) start {NSAssert (_animatedView, @ “Lantul de animatie nu poate fi creat deoarece vizualizarea animata este nula.”); AXChainAnimator * superAnimator = _superAnimator; AXChainAnimator * superSuperAnimator = _superAnimator; while (superAnimator) {superAnimator = superAnimator.superAnimator; if (superAnimator) {superSuperAnimator = superAnimator; }} if (superSuperAnimator) {[superSuperAnimator start]; } else {[self _beginAnimating]; if (! _childAnimator) [self _clear]; }}

AXAnimatioChain 就是 通过 这样 的 关系 把 所有链接组合的 animator 管理 起来 的 , 在 完成 关系 的 链接 或 组合 之后 , 需要 向 最后 一个 animator 发送 -start 消息 动画 才能 正常 进行. animator在接收到-Start消息之后,会逐级遍历superAnimator直至superAnimator.superAnimator == nil,此时获取到superSuperAnimator,从superSuperAnimator自祖先往下逐级进行动画,组合的动画会同时进行,链接的动画则按顺序进行.

Caracteristici

  • 轻量级 解决 方案
  • 基于 CoreAnimation 的 封装 , 安全 、 高效!
  • 一行 代码 搞定 复杂 的 动画 管理 , 提高 代码 维护 效

TimingControl

时间 曲线 , 时间 曲线 用于 描述 动画 随 时间 进行 的 速度 , AXAnimationChain 除了 包含 系统 默认 的 时间 曲线 之外 , 还 提供 了 如下 的 曲线 以 呈现 更 漂亮 的 动画 :

AXSpringAnimation

CoreAnimation 自 iOS2.0 就 为 iOS 平台 提供 了 核心 动画 的 支持 , 但是 在 iOS9.0 之前 , 一直 没有 Spring 动画 , 要 使用 Spring 动画 要么 使用 第三方 动画 库 , 要么 使用 系统 提供 的 方法:

+ (void) animateWithDuration: (NSTimeInterval) delay delay: (NSTimeInterval) delay folosind SpringSithDamping: (CGFloat) dampingRatio initialSpringVelocity: (CGFloat) optiuni de viteza: (UIViewAnimationOptions) optiuni animatii: (void (^) (void) (^ __anulabil) (BOOL terminat)) finalizare NS_AVAILABLE_IOS (7_0);

但是 系统 提供 的 这个 方法 也是 iOS7.0 以后 才能 使用 了 , 并且 在 控制 上 并非 那么 容易.

AXSpringAnimation 是 基于阻尼 震动运动 模型 的 Spring 动画 类 , 能够 完美 与 CASpringAnimation 相 通用 :

动画 中 , 左边 正方形 使用 的 是 CASpringAnimation 类 , 右边 的 则 使用 的 是 AXSpringAnimation , 两者 的 动画 曲线 是 一致 的.

同样 地 , AXSpringAnimation 的 API 和 CASpringAnimation 也是 一致 的 :

@interface AXSpringAnimation: CAKeyframeAnimation / * Masa obiectului atasat la sfarsitul arcului. Trebuie sa fie mai mare de 0. Implicit la unul. * / @property (assign, nonatomic) CGFloat mass; / * Coeficientul de rigiditate a arcului. Trebuie sa fie mai mare de 0. * Valori implicite la 100. * / @property (assign, nonatomic) CGFloat rigidity; / * Coeficientul de amortizare. Trebuie sa fie mai mare sau egal cu 0. * Valori implicite la 10. * / @property (assign, nonatomic) CGFloat damping; / * Viteza initiala a obiectului atasat arcului. Valori implicite * la zero, care reprezinta un obiect care nu se misca. Valorile negative * reprezinta obiectul care se indeparteaza de punctul de fixare a arcului, * valorile pozitive reprezinta obiectul care se deplaseaza spre arc * punctul de atasare al arcului. * / @property (assign, nonatomic) CGFloat initialVelocity; / * Returneaza durata estimata necesara pentru ca sistemul de arc sa fie * luat in considerare in repaus. Durata este evaluata pentru parametrii curenti de animatie *. * / @property (readonly, nonatomic) CFTimeInterval settlingDuration; / * Obiectele care definesc valorile proprietatii fiind interpolate intre. * Toate sunt optionale si cel mult doua ar trebui sa fie nenule. Tipul de obiect * trebuie sa se potriveasca cu tipul proprietatii care este animata (folosind * regulile standard descrise in CALayer.h). Modurile de animatie * acceptate sunt: ​​* * – atat „de la valoare”, cat si „la valoare” non-nul. Interpoleaza intre * `fromValue ‘si` toValue’. * * – „fromValue” si „byValue” non-nul. Interpoleaza intre * “fromValue” si “fromValue” plus “byValue”. * * – „byValue” si „toValue” non-nul. Interpoleaza intre „toValue” * minus `byValue ‘si` toValue’. * / @property (nul, puternic, nonatomic) id fromValue; @property (nul, puternic, nonatomic) id toValue; @property (nul, puternic, nonatomic) id byValue; @Sfarsit

Convertibil

AXAnimationChain 框架 还 提供 了 将 CABasicAnimation 无缝 转换 为 CAKeyframeAnimation 的 功能 :

动画 中 , 左边 是 CABasicAnimation , 右边 是 CAKeyframeAnimation , 两者 对应 的 动画 曲线 是 一致 的.

要 使用 动画 转换 , 请 参考 :

#import <QuartzCore / QuartzCore.h> #import <UIKit / UIKit.h> #import “CAMediaTimingFunction + Extends.h” @interface CAAnimation (convertibil) @end @interface CAKeyframeAnimation (convertibil) + (instancetype) animationWithBasic: (CABasicAnimation * ) Animatie de baza; + (instancetype) animationWithBasic: (CABasicAnimation *) basicAnimation usingValuesFunction: (double (^) (double t, double b, double c, double d)) valuesFunction; @Sfarsit

Cerinte

AXAnimationChain 对 系统 版本 支持 到 iOS8.0 , 需要 使用 到 的 框架 :

  • Fundatie.cadrul
  • UIKit.framework
  • QuartzCore.framework

使用 的 时候 最好 使用 最新 版 Xcode.

Adaugarea AXAimationChain la proiectul dvs.

CocoaPods

CocoaPods este modalitatea recomandata de a adauga AXAimationChain la proiect.

  1. Adaugati o intrare pod pentru AXAimationChain la pod-ul Podfile „AXAimationChain”, „~> 0.2.3”
  2. Instalati pod-ul (pod-urile) executand instalarea pod-ului.
  3. Include AXAimationChain oriunde ai nevoie de el cu #import “AXAimationChain.h”.
  4. 若 需要 单独 使用 AXSpringAnimation 或者 Convertibil 以及 TimingControl 等 特性 的 话 , 只需 要将 podfile 里边 AXAnimationChain 替换 为 AXAnimationChain / CoreAnimation 即可 , 即 : pod ‘AXAimationChain / CoreAnimation’, ‘
  5. 若要 使用 Swift 作为 变成 语言 , 请 使用 Swift 版 的 依赖 包 : pod ‘AXAimationChain-Swift’, ‘~> 0.2.3’

Fisiere sursa

Alternativ, puteti adauga direct toate fisierele sursa la proiect.

  1. Descarcati cea mai recenta versiune de cod sau adaugati depozitul ca submodul git la proiectul dvs. git-tracked. 
  2. Deschideti-va proiectul in Xcode, apoi glisati si fixati grupul sursa in proiect (utilizati „vizualizarea Navigator produs”). Asigurati-va ca selectati Copierea articolelor cand vi se solicita daca ati extras arhiva de cod in afara proiectului dvs. 
  3. Includeti AXAnimationChain oriunde aveti nevoie de el cu #import “AXAimationChain.h”.
  4. 如 单独 使用 AXSpringAnimation 或者 Convertibil 以及 TimingControl 等 特性 , 只 需要 导入 #import “AXCoreAnimation.h” 即可.

Licenta

Acest cod este distribuit in termenii si conditiile licentei MIT. 

使用

API 请 参考 示例 工程 代码 以及.

不足

此 项目 在 开展 的 时候 比较 庞大 , 基础 的 核心 类 已经 构建 好 , 基本 目标 已经 达成 , 但是 还有 很多 需要 的 地方 , 后边 会 逐步 完善 并 发布 Release 版本.

声明

转载 需 注明 出处 : http: //devedbox.com/AXAnimationChain/