{"id":2359,"url":"https://github.com/satoshin21/Anima","last_synced_at":"2025-08-02T23:33:18.123Z","repository":{"id":20298515,"uuid":"89384580","full_name":"satoshin21/Anima","owner":"satoshin21","description":"Anima is chainable Layer-Based Animation library for Swift5.","archived":false,"fork":false,"pushed_at":"2023-12-15T08:20:32.000Z","size":3348,"stargazers_count":587,"open_issues_count":3,"forks_count":24,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-24T14:47:49.156Z","etag":null,"topics":["chainable-animations","coreanimation"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/satoshin21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-25T16:47:48.000Z","updated_at":"2024-04-24T04:25:53.000Z","dependencies_parsed_at":"2024-01-02T21:14:22.017Z","dependency_job_id":"9671e131-12af-4330-b732-dd157c1eee71","html_url":"https://github.com/satoshin21/Anima","commit_stats":{"total_commits":57,"total_committers":4,"mean_commits":14.25,"dds":0.07017543859649122,"last_synced_commit":"24d3d917fdfc4623ebd6d1748714991660bd9fd4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin21%2FAnima","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin21%2FAnima/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin21%2FAnima/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satoshin21%2FAnima/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satoshin21","download_url":"https://codeload.github.com/satoshin21/Anima/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228503194,"owners_count":17930534,"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":["chainable-animations","coreanimation"],"created_at":"2024-01-05T20:16:11.811Z","updated_at":"2024-12-06T17:31:02.427Z","avatar_url":"https://github.com/satoshin21.png","language":"Swift","funding_links":[],"categories":["UI","HarmonyOS"],"sub_categories":["Animation","Other free courses","Windows Manager"],"readme":"[![Version](https://img.shields.io/cocoapods/v/Anima.svg?style=flat)](http://cocoapods.org/pods/Anima)\n[![License](https://img.shields.io/cocoapods/l/Anima.svg?style=flat)](http://cocoapods.org/pods/Anima)\n[![Platform](https://img.shields.io/cocoapods/p/Anima.svg?style=flat)](http://cocoapods.org/pods/Anima)\n![language](https://img.shields.io/badge/Language-Swift4-8E44AD.svg)\n![Version](https://img.shields.io/badge/Pod-%20v2.0.1%20-96281B.svg)\n![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)\n![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg)\n![Platform](https://img.shields.io/badge/platform-%20iOS%20-lightgrey.svg)\n![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./img/eyecatch.png\"/\u003e\n\u003c/p\u003e\n\n# Anima\n\nAnima is chainable Layer-Based Animation library for Swift5.\u003cbr\u003e\nIt support to make sequensial and grouped animation more easily.\n\n\u003cimg src=\"./img/eyecatch.gif\" width=700px\u003e\n\nis written as follows.\n\n```swift\nlet startAnimations: [AnimaType] = [.moveByY(-50), .rotateByZDegree(90)]\nlet moveAnimations: [AnimaType] = [.moveByX(50), .rotateByZDegree(90)]\nlet endAnimations: [AnimaType] = [.moveByY(-50), .rotateByZDegree(90)]\n\nanimaView.layer.anima\n    .then(.opacity(1.0))\n    .then(group: startAnimations)\n    .then(group: moveAnimations, options: labelAnimaOption(index: 0))\n    .then(group: moveAnimations, options: labelAnimaOption(index: 1))\n    .then(group: moveAnimations, options: labelAnimaOption(index: 2))\n    .then(group: moveAnimations, options: labelAnimaOption(index: 3))\n    .then(group: endAnimations, options: labelAnimaOption(index: 4))\n    .then(group: [.scaleBy(0.0), .opacity(0.0)])\n\nfunc labelAnimaOption(index: Int) -\u003e [AnimaOption] {\n    let labelAnima = labels[index]?.layer.anima\n\n    return [.completion({\n        labelAnima?.then(.opacity(1)).fire()\n    })]\n}\n```\n\n## Requirements\n\nAnima require for Swift4 and greater than iOS9.0📱\u003cbr\u003e\n\n## Features\n\n- Almost all timing modes from [easings.set](http://easings.net/) are implemented.\n- Spring Animation ( featured by [CASpringAnimation](https://developer.apple.com/reference/quartzcore/caspringanimation) )\n- Type-Safed Animation KeyPath ()\n\n## Usage\n\n### Move Position\n\nIf you want to translate `CALayer.position` relatively, use `.moveByX(CGFloat)`, `.moveByY(CGFloat)`, `.moveByXY(x: CGFloat, y: CGFloat)` AnimaTypes.\n\n\u003cimg src=\"./img/sample_move.gif\" width=300px\u003e\n\n```swift\nlayer.anima.then(.moveByX(50)).fire()\n```\n\nor destination is determined, use `.moveTo(x: CGFloat, y: CGFloat)`.\n\n※ Anima doesn't update `CALayer.position` value for animations. Because when update Layer-backed view's layer position value, It will be resetted to default value frequently.\n\n### Sequential Animation\n\nAnima supports.\n\n### Group Animation\n\nTo run animation concurrently, you use `CAAnimationGroup` with CoreAnimation.\nIn Anima, you can use `Anima.then(group: )` to run some `AnimaType` concurrently.\n\nBelow is an example of how to run moving, scaling and rotating animations concurrently.\n\n\u003cimg src=\"./img/sample_group.gif\" width=300px\u003e\n\n```swift\nlayer.anima\n    .then(group: [.moveByX(200),\n                .scaleBy(1.5),\n                .rotateByZDegree(180)])\n    .fire()\n```\n\n### Animation Options\n\nThere are some options for Anima.\n\n- duration(TimeInterval)\n- timingFunction(TimingFunction)\n  _ Change timing function defining the pacing of the animation.\n  _ Default timing function is at `Anima.defaultTimingFunction`. If you do not set the timing function option, defaultTimingFunction is used. \\* Please read `Anima.TimingFunction.swift`\n- repeat(count: Float) \\* To run animation infinitely, set `.infinity`.\n- autoreverse\n- completion(() -\u003e Void)\n\nyou can use these values as belows.\n\n```\nlayer\n    .anima\n    .then(.moveByX(100), options: [.autoreverse,\n                                   .timingFunciton(.easeInQuad),\n                                   .repeat(count: 3),\n                                   .completion({\n                                    print(\"completion\")\n                                   })])\n    .fire()\n```\n\n### Rotate Animation \u0026 AnchorPoint\n\nAnimaType has 3 rotation animation type, `.rotateByX`, `.rotateByY`, `.rotateByZ`.\nand each animation type has 2 value types, `degrees` and `radians`.\nyou use whichever you like.\n\nand CALayer has `AnchorPoint`. Rotating, moving, or other Animations are affected by it. Default value is (0.5, 0.5).\n`AnimaType.moveAnchor(AnimaAnchorPoint)` can move layer's AnchorPoint.\n\n\u003cimg src=\"./img/sample_rotate.gif\" width=300px\u003e\n\n```swift\nlayer.anima\n    .then(.rotateByZDegree(360))\n    .then(.moveAnchor(.topLeft))\n    .then(.rotateByZDegree(360))\n    .fire()\n```\n\nor If you want to change only AnchorPoint, use `Anima.then(setAnchor: AnimaAnchorPoint)`.\n\n\u003cimg src=\"./img/sample_anchor.gif\" width=300px\u003e\n\n```swift\nlayer.anima\n    .then(.rotateByZDegree(360))\n    .then(setAnchor: .topLeft)\n    .then(.rotateByZDegree(360))\n    .fire()\n```\n\n### Move Path\n\nIf you want to make moving animation more complex, use `.movePath(path: CGPath, keyTymes: [Double])`.\nAnima example app has sample of creating animation by drag gesture. you see it!\n\nbut It has any problems when you use with `AnimaOption.autoreverse`.\nso If you use it, please be careful of options.\n\n### Original KeyPath\n\nIf you want to animate other animatable values, You can use `AnimaType.original(keyPath: String, from: Any?, to: Any)` for it.\n`CAEmitterLayer`'s animation is like this.\n\n```swift\nlet layer = CAEmitterLayer()\nlayer.emitterPosition = CGPoint(x: 100.0, y:100.0)\n\nlayer.anima\n    .then(.original(keyPath: #keyPath(CAEmitterLayer.emitterPosition), from: layer.emitterPosition, to: CGPoint(x: 200.0, y:200.0)))\n    .fire()\n```\n\n## Example\n\nTo run the example project, clone the repo, open `Anima.xcodeproj`, and run target `Anima iOS Example`.\n\n## Installation\n\n### Cocoapods\n\nAnima is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"Anima\"\n\n# If you want to use Swift 3 version, Please specify Anima version.\n\npod \"Anima\", \"0.5.1\"\n```\n\n### Carthage\n\nAdd github `satoshin21/Anima` to your `Cartfile`.\nExecute carthage update to install it.\n\n## Author\n\nSatoshi Nagasaka, satoshi.nagasaka21@gmail.com\n\n## License\n\nAnima is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatoshin21%2FAnima","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatoshin21%2FAnima","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatoshin21%2FAnima/lists"}