zoukankan      html  css  js  c++  java
  • [翻译] CHAnimation

    CHAnimation

    https://github.com/cyndibaby905/CHAnimation

    How it looks

    CHAnimation is a project used to demonstrate how to write your own animation engine, inspired by Facebook Pop, with only 600 lines of Objective-C you can understand.

    You can also use this project to help learning Facebook Pop.

    CHAnimation是一个用来帮助你写你自己动画的引擎工具,受到了Facebook Pop的启发,只有600行的代码,你能够轻易的明白。

    你也可以使用此工程来学习Facebook的Pop动画。

    Requirements

    CHAnimation requires Xcode 5, targeting either iOS 5.0 and above, ARC-enabled.

    CHAnimation需要Xcode5,目标在iOS5.0以上,仅支持ARC。

    Types

    Unlike Facebook PopCHAnimation supports only one animation type, that is linear animation. The main purpose of this project is to help developer understand how an animation engine works, so I tried my best to keep the code small and clean. I think if you finished reading the code of CHAnimation, you can add moretimingFunction as you want.

    Currently, CHAnimation supports CGSizeCGPoint and NSNumber as animated values, you can add more types if you want.

    不像Facebook Pop动画支持动画的类型多,CHAnimation支持得动画类型是线性动画类型。这个项目的主要动机是帮助开发者理解动画引擎如何工作的,所以我尽最大的努力来保持代码轻量以及清晰。我相信,如果你读完了这个代码,你已经可以根据需要随意添加 timingFunction 方法了。

    当前,CHAnimation支持CGSize,CGPoint以及NSNumber作为动画的values,你可以根据你的需要添加更多类型。

    How to use

    CHAnimation adopts the Core Animation explicit animation programming model, the interfaces are almost the same:

    CHAnimation兼容Core Animation显式动画模型,这个使用接口基本上是一样的:

    #import "CHAnimation.h"
    
    CHAnimation *animation = [CHAnimation new];
    animation.duration = 0.4;
    
    animation.writeBlock = ^(id obj, id value) {
        button.center = [value CGPointValue];
    };
    
    animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(70, 70)];
    animation.toValue = [NSValue valueWithCGPoint:CGPointMake(170, 170)];
    
    [button ch_addAnimation:animation forKey:@"animation"]; 
    

    Resources

    A collection of links to external resources may help you to understand the code:

    以下链接能帮助你理解这些代码:

  • 相关阅读:
    go module基本使用
    jquery的radio的change事件
    etcd 快速入门
    linux下查看php-fpm是否开启以及如何开启
    js 获取某年的某天是第几周
    gland go list-m:无法识别的导入路径
    Xshell连接有跳板机(堡垒机)的服务器
    PHP中时间戳和时区
    SQL分页过多时, 如何优化
    MySQL语句的优化
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3826685.html
Copyright © 2011-2022 走看看