Canvas 框架使用iOS

Canvas 是一个高效的iOS动画库使用起来也是非常简单的,一般情况下一句代码就差不多搞定了而且它的动画效果差不多也都可以由runtime Attribute的属性来进行实现的,在使用xib的情况下 一句 [self.view startCanvasAnimation]; 就可以实现动画效果了

  • 通过xib的话只需要设置下就ok了


    设置内容
  • 通过代码

CSAnimationView *animationView = [[CSAnimationView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
animationView.backgroundColor = [UIColor whiteColor];
animationView.duration = 0.5;
animationView.delay = 0;
animationView.type = CSAnimationTypeMorph;
[self.view addSubview:animationView];
//添加你想增加效果的 View 为 animationView 的子视图
// [animationView addSubview:<#(UIView *)#>]
[animationView startCanvasAnimation];
Canvas 中提供的动画效果有29中 我最常用的是pop 当然 PopSDK中也提供了这种动画效果,至于如何选择就看各自的爱好了,接下来有空的话会整理一套Pop的动画效果作为比较的!
static CSAnimationType CSAnimationTypeBounceLeft   = @"bounceLeft";
static CSAnimationType CSAnimationTypeBounceRight  = @"bounceRight";
static CSAnimationType CSAnimationTypeBounceDown   = @"bounceDown";
static CSAnimationType CSAnimationTypeBounceUp     = @"bounceUp";
static CSAnimationType CSAnimationTypeFadeIn       = @"fadeIn";
static CSAnimationType CSAnimationTypeFadeOut      = @"fadeOut";
static CSAnimationType CSAnimationTypeFadeInLeft   = @"fadeInLeft";
static CSAnimationType CSAnimationTypeFadeInRight  = @"fadeInRight";
static CSAnimationType CSAnimationTypeFadeInDown   = @"fadeInDown";
static CSAnimationType CSAnimationTypeFadeInUp     = @"fadeInUp";
static CSAnimationType CSAnimationTypeSlideLeft    = @"slideLeft";
static CSAnimationType CSAnimationTypeSlideRight   = @"slideRight";
static CSAnimationType CSAnimationTypeSlideDown    = @"slideDown";
static CSAnimationType CSAnimationTypeSlideUp      = @"slideUp";
static CSAnimationType CSAnimationTypePop          = @"pop";
static CSAnimationType CSAnimationTypeMorph        = @"morph";
static CSAnimationType CSAnimationTypeFlash        = @"flash";
static CSAnimationType CSAnimationTypeShake        = @"shake";
static CSAnimationType CSAnimationTypeZoomIn       = @"zoomIn";
static CSAnimationType CSAnimationTypeZoomOut      = @"zoomOut";
static CSAnimationType CSAnimationTypeSlideDownReverse  = @"slideDownReverse";
static CSAnimationType CSAnimationTypeFadeInSemi        = @"fadeInSemi";
static CSAnimationType CSAnimationTypeFadeOutSemi       = @"fadeOutSemi";
static CSAnimationType CSAnimationTypeFadeOutRight      = @"fadeOutRight";
static CSAnimationType CSAnimationTypeFadeOutLeft       = @"fadeOutLeft";
static CSAnimationType CSAnimationTypePopDown           = @"popDown";
static CSAnimationType CSAnimationTypePopAlpha          = @"popAlpha";
static CSAnimationType CSAnimationTypePopAlphaUp        = @"popAlphaUp";
static CSAnimationType CSAnimationTypePopAlphaOut       = @"popAlphaOut";

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容