{"id":15027127,"url":"https://github.com/robb/rbbanimation","last_synced_at":"2025-05-15T06:03:16.862Z","repository":{"id":39310723,"uuid":"13504233","full_name":"robb/RBBAnimation","owner":"robb","description":"Block-based animations made easy, comes with easing functions and a CASpringAnimation replacement.","archived":false,"fork":false,"pushed_at":"2022-06-24T14:03:15.000Z","size":117,"stargazers_count":2066,"open_issues_count":6,"forks_count":182,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-05-15T06:03:03.173Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"robb"}},"created_at":"2013-10-11T16:49:57.000Z","updated_at":"2025-05-09T10:55:54.000Z","dependencies_parsed_at":"2022-09-12T11:41:33.118Z","dependency_job_id":null,"html_url":"https://github.com/robb/RBBAnimation","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FRBBAnimation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FRBBAnimation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FRBBAnimation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robb%2FRBBAnimation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robb","download_url":"https://codeload.github.com/robb/RBBAnimation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283336,"owners_count":22045140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T20:05:49.269Z","updated_at":"2025-05-15T06:03:16.833Z","avatar_url":"https://github.com/robb.png","language":"Objective-C","funding_links":["https://github.com/sponsors/robb"],"categories":[],"sub_categories":[],"readme":"# RBBAnimation\n\n\u003ca href=\"https://travis-ci.org/robb/RBBAnimation?branch=master\"\u003e\n    \u003cimg src=\"https://travis-ci.org/robb/RBBAnimation.svg?branch=master\" align=\"right\"\u003e\n\u003c/a\u003e\n\n`RBBAnimation` is a subclass of `CAKeyframeAnimation` that allows you to\ndeclare your __animations using blocks__ instead of writing out all the\nindividual key-frames.\n\nThis gives you greater flexibility when specifying your animations while keeping\nyour code concise.\n\nIt comes out of the box with a [replacement for\nCASpringAnimation](#rbbspringanimation), [support for custom easing functions\nsuch as bouncing](#rbbtweenanimation) as well as hooks to allow your writing\nyour [own animations fully from scratch](#rbbcustomanimation).\n\n## Installation\n\nTo install RBBAnimation, I recommend the excellent [CocoaPods]. Simply add this\nto your Podfile\n\n```ruby\npod 'RBBAnimation', '0.4.0'\n```\n\nand you are ready to go!\n\nIf you'd like to run the bundled test app, make sure to install its dependencies\nby running\n\n```sh\npod install\n```\n\nafter cloning the repo.\n\n## RBBCustomAnimation\n\nUse `RBBCustomAnimation` to create arbitrary animations by passing in an\n`RBBAnimationBlock`:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"http://robb.is/img/rbbanimation/rainbow.gif\" alt=\"Rainbow\" title=\"RBBCustomAnimation\"\u003e\n\u003c/p\u003e\n\n```objc\nRBBCustomAnimation *rainbow = [RBBCustomAnimation animationWithKeyPath:@\"backgroundColor\"];\n\nrainbow.animationBlock = ^(CGFloat elapsed, CGFloat duration) {\n    UIColor *color = [UIColor colorWithHue:elapsed / duration\n                                saturation:1\n                                brightness:1\n                                     alpha:1];\n\n    return (id)color.CGColor;\n};\n```\n\nThe arguments of the block are the current position of the animation as well as\nits total duration.\n\nMost of the time, you will probably want to use the higher-level\n`RBBTweenAnimation`.\n\n## RBBSpringAnimation\n\n`RBBSpringAnimation` is a handy replacement for the private [CASpringAnimation].\nSpecify your spring's mass, damping, stiffness as well as its initial velocity\nand watch it go:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"http://robb.is/img/rbbanimation/spring.gif\" alt=\"Bouncing\" title=\"RBBSpringAnimation\"\u003e\n\u003c/p\u003e\n\n```objc\nRBBSpringAnimation *spring = [RBBSpringAnimation animationWithKeyPath:@\"position.y\"];\n\nspring.fromValue = @(-100.0f);\nspring.toValue = @(100.0f);\nspring.velocity = 0;\nspring.mass = 1;\nspring.damping = 10;\nspring.stiffness = 100;\n\nspring.additive = YES;\nspring.duration = [spring durationForEpsilon:0.01];\n```\n\n## RBBTweenAnimation\n\n`RBBTweenAnimation` allows you to animate from one value to another, similar to\n`CABasicAnimation` but with a greater flexibility in how the values should be\ninterpolated.\n\nIt supports the same cubic Bezier interpolation that you get from\n`CAMediaTimingFunction` using the `RBBCubicBezier` helper function:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"http://robb.is/img/rbbanimation/ease-in-out-back.gif\" alt=\"Ease In Out Back\" title=\"RBBCubicBezier(0.68, -0.55, 0.265, 1.55)\"\u003e\n\u003c/p\u003e\n\n```objc\nRBBTweenAnimation *easeInOutBack = [RBBTweenAnimation animationWithKeyPath:@\"position.y\"];\n\neaseInOutBack.fromValue = @(-100.0f);\neaseInOutBack.toValue = @(100.0f);\neaseInOutBack.easing = RBBCubicBezier(0.68, -0.55, 0.265, 1.55);\n\neaseInOutBack.additive = YES;\neaseInOutBack.duration = 0.6;\n```\n\nHowever, `RBBTweenAnimation` also supports more complex easing functions such as\n`RBBEasingFunctionEaseOutBounce`:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"http://robb.is/img/rbbanimation/bounce.gif\" alt=\"Bouncing\" title=\"RBBEasingFunctionEaseOutBounce\"\u003e\n\u003c/p\u003e\n\n```objc\nRBBTweenAnimation *bounce = [RBBTweenAnimation animationWithKeyPath:@\"position.y\"];\nbounce.fromValue = @(-100);\nbounce.toValue = @(100);\nbounce.easing = RBBEasingFunctionEaseOutBounce;\n\nbounce.additive = YES;\nbounce.duration = 0.8;\n```\n\nYou can also specify your own easing functions, from scratch:\n\n```objc\nRBBTweenAnimation *sinus = [RBBTweenAnimation animationWithKeyPath:@\"position.y\"];\nsinus.fromValue = @(0);\nsinus.toValue = @(100);\n\nsinus.easing = ^CGFloat (CGFloat fraction) {\n    return sin((fraction) * 2 * M_PI);\n};\n\nsinus.additive = YES;\nsinus.duration = 2;\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"http://robb.is/img/rbbanimation/sine-wave.gif\" alt=\"Sine Wave\" title=\"Custom Easing Function\"\u003e\n\u003c/p\u003e\n\n## License\n\nRBBAnimation was built by [Robert Böhnke][robb]. It is licensed under the MIT\nLicense.\n\nIf you use RBBAnimation in one of your apps, I'd love to hear about it. Feel\nfree to follow me on Twitter where I'm [@ceterum_censeo][twitter].\n\n[caspringanimation]: https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/QuartzCore.framework/CASpringAnimation.h\n[robb]: http://robb.is\n[twitter]: https://twitter.com/ceterum_censeo\n[cocoapods]: http://cocoapods.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobb%2Frbbanimation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobb%2Frbbanimation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobb%2Frbbanimation/lists"}