UIView-Easing 0.0.1

UIView-Easing 0.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2014年12月

Tapan Thaker 维护。



  • Tapan Thaker

UIView+Easing

灵感来源于 UIView-EasingFunctions,在实现上有所不同,本插件不使用 AHEasing,而是使用 CAMediaTimingFunction。主要是因为之前提到的仓库不支持 ios8,导致动画出现跳动,并且存在 64 位架构的问题。

支持状态

请参阅 easings.net 了解所有不同的缓动效果。

  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc
  • easeInBack
  • easeOutBack
  • easeInOutBack

使用方法

只需将 UIView+Easing.h & UIView+Easing.m 文件导入到您的项目目录中,并按以下方式使用

    [self.dialogView setEasingFunction:easeOutBack forKeyPath:@"center"];
    [UIView animateWithDuration:.6 animations:^{
        self.dialogView.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds));
    } completion:^(BOOL finished) {

    [self.dialogView removeEasingFunctionForKeyPath:@"center"];
    [self.dialogView removeEasingFunctionForKeyPath:@"transform"];

    }];

使用您自定义的缓动函数

    [self.button setEasingFunction:CreateCAMediaTimingFunction(0.47, 0, 0.745, 0.715) forKeyPath:@"center"];
    [UIView animateWithDuration:.6 animations:^{
        self.button.center = CGPointMake(160,80);
    } completion:^(BOOL finished) {

    [self.button removeEasingFunctionForKeyPath:@"center"];

    }];

示例

Click here to redirect to youtube (Too bad github doesn't provide video embedding)

联系方式

关注 Twitter (@tapthaker