GithubHelp home page GithubHelp logo

iftachorr / nsbkeyframeanimation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nachosoto/nsbkeyframeanimation

0.0 2.0 0.0 260 KB

jQuery-like animations in CoreAnimation

License: MIT License

nsbkeyframeanimation's Introduction

NSBKeyframeAnimation

I started implementing this class as part of one of the demos in the CoreAnimation class I gave in Madrid on July 2012 (http://www.youtube.com/watch?v=54ESi6snSfI). I decided to finish it and create a sample project with it.

NSBKeyframeAnimation allows you to create jQuery-like animations with a high level interface in a similar way as you would do with -[UIView animateWithDuration:delay:options:animations:completion:], but with any kind of function. You can animate any keypath between two values (for now they have to be scalar but I'll add support for any NSValue).

NSBKeyframeAnimation

Example:

NSBKeyframeAnimation *animation = [NSBKeyframeAnimation animationWithKeyPath:@"position.x"
                                                                    duration:5
                                                                  startValue:0
                                                                    endValue:1000
                                                                    function:NSBKeyframeAnimationFunctionEaseInOutCubic];

[view.layer setValue:animation.values.lastObject forKeyPath:@"position.x"];
[view.layer addAnimation:animation forKey:@"position.x"];

Future improvements

  • I'm working on a category to UIView to make using this class a much easier task. Coming soon!
  • I will add helper methods so that you can easily generate animations on the transform keypath and create really cool effects.

How To Use

  • Run git submodule add https://github.com/NachoSoto/NSBKeyframeAnimation Dependencies/NSBKeyframeAnimation
  • Add Dependencies/NSBKeyframeAnimation/Classes/NSBKeyframeAnimation files to your project.
  • Add QuartzCore.framework to project libraries.
  • You're all set!

Compatibility:

  • NSBKeyframeAnimation doesn't use ARC. You can compile it in your ARC project by adding the linker flag -fno-objc-arc.

Licence

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

nsbkeyframeanimation's People

Contributors

nachosoto avatar sampage avatar cool8jay avatar

Watchers

James Cloos avatar Iftach 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.