Skip to content
项目

关于

CHAnimation is a project used to demonstrate how to write your own animation engine, inspired by Facebook Pop.

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

CHAnimation

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.

Requirements

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

Types

Unlike Facebook Pop, CHAnimation 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 more timingFunction as you want.

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

How to use

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

#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:

How it looks

![CHAnimation] (https://raw.github.com/cyndibaby905/CHAnimation/master/CHAnimation.gif)

Lincense

CHAnimation is available under the MIT license. See the LICENSE file for more info.

探索相关项目

加载中…