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:

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

[翻译] CHAnimation的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. codeblocks中文编码问题

    其实这是老调重弹的问题了,在windows下面出现中文乱码大多都是编码格式的问题不一致的问题,最简单的就是uft-8和gbk冲突的问题.如果一个文件本来是以utf-8存的,但是以gbk打开,当然会出现 ...

  2. js中请求数据的$post和$ajax区别(同步和异步问题)

    $.post和$.Ajax都为页面上向后台发送请求,请求数据 1.post 因为post默认为异步请求,可是有时候我们会发现,本来要求请求马上出现,可是异步会导致后面突然再执行,这样就出很多问题 2. ...

  3. Go语言学习笔记三: 常量

    Go语言学习笔记三: 常量 定义常量 常量就是在声明后不能再修改的量. const x int = 100 const y string = "abc" const z = &qu ...

  4. 关系型数据库MySQL多实例

    简介 MySQL数据库是一个中小型关系型数据库管理系统,软件开发者为瑞典MySQL AB公司.在2008年1月16号被Sun公司收购后Sun公司又被oracle公司收购.目前MySQL被广泛地应用在I ...

  5. Android Anwendungsprogramm Entwicklung

    1.Einführung des Androids 1.1 Grundlage der Anwendung Activity ist eine Spezifische Bespiel von Andr ...

  6. [转] sqlserver 中查看trigger的disabled/enabled情况

    本文转自:http://blog.csdn.net/miqi770/article/details/48708199 SELECT t.name AS TableName, tr.name AS Tr ...

  7. Java学习--扑克牌比大小的小游戏

    实现:生成五十四张牌,然后进行洗牌,输入两名玩家,然后分别发两张牌,进行比较大小,两张牌中拥有较大一张牌的玩家获胜 Card.java代码如下: package com.cardgame; publi ...

  8. 十一、spark SQL的scala示例

    简介 spark SQL官网:http://spark.apache.org/docs/latest/sql-programming-guide.html sparkSQL是构建在sparkCore之 ...

  9. 二、hive shell常用命令

    在使用hive shell之前我们需要先安装hive,并启动hdfs 请参考:https://www.cnblogs.com/lay2017/p/9973298.html hive shell 我们先 ...

  10. CentOS 安装Parallels Tools

    为了做到Mac和Linux之间共享文件夹,因此需要安装Parallels Tool, 具体安装步骤可以参考 install parallels tool for linux guest http:// ...