Code Monkey home page Code Monkey logo

chanimation's Introduction

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.

chanimation's People

Contributors

cyndibaby905 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.