{"id":15037512,"url":"https://github.com/cokaholic/donut","last_synced_at":"2025-06-11T05:33:09.152Z","repository":{"id":56908667,"uuid":"103622351","full_name":"cokaholic/Donut","owner":"cokaholic","description":"Donut is a library for arranging views circularly like a donut.","archived":false,"fork":false,"pushed_at":"2017-09-27T07:22:51.000Z","size":6974,"stargazers_count":143,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T01:16:48.413Z","etag":null,"topics":["animation","animation-3d","animation-library","carthage","circular","cocoapods","ios","swift","swift-library","swift3","xcode"],"latest_commit_sha":null,"homepage":null,"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/cokaholic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-15T06:29:40.000Z","updated_at":"2024-05-22T05:30:54.000Z","dependencies_parsed_at":"2022-08-21T01:51:00.398Z","dependency_job_id":null,"html_url":"https://github.com/cokaholic/Donut","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cokaholic%2FDonut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cokaholic%2FDonut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cokaholic%2FDonut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cokaholic%2FDonut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cokaholic","download_url":"https://codeload.github.com/cokaholic/Donut/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cokaholic%2FDonut/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259207762,"owners_count":22821759,"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":["animation","animation-3d","animation-library","carthage","circular","cocoapods","ios","swift","swift-library","swift3","xcode"],"created_at":"2024-09-24T20:34:52.800Z","updated_at":"2025-06-11T05:33:09.131Z","avatar_url":"https://github.com/cokaholic.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/logo.png\" width=\"500\"\u003e\n\u003c/p\u003e\n\n# Overview\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/overview.gif\" width=\"300\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cb\u003eDonut\u003c/b\u003e\u003ca\u003e is a library for arranging views circularly like a donut.\u003cbr\u003e\u003cbr\u003eYou can use it so easily, and it will be a wonderful experience for you.\u003cbr\u003e\u003cbr\u003eThis library is inspired by \u003c/a\u003e\u003ca href=\"https://github.com/emadrazo/EMCarousel\"\u003eEMCarousel\u003c/a\u003e\u003ca\u003e.\u003c/a\u003e\n\u003c/p\u003e\n  \n# Contents\n- [Features](#features)\n- [Usage](#usage)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Author](#author)\n\n## \u003ca name=\"features\"\u003e Features\n\n![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat-square\n)\n[![Cocoapods](https://img.shields.io/badge/Cocoapods-compatible-brightgreen.svg)](https://img.shields.io/badge/Cocoapods-compatible-brightgreen.svg?style=flat-square)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-Compatible-brightgreen.svg?style=flat-square)](https://github.com/Carthage/Carthage)\n[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat-square\n)](http://mit-license.org)\n![Swift](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat-square)\n![pod](https://img.shields.io/badge/pod-v1.2.0-red.svg?style=flat-square)\n\n- [x] Animated item selection\n- [x] Add items with animation\n- [x] Support auto cell alignment center\n- [x] Support 3D inclination angle (x, z)\n- [x] Support animation curve （linear, easeInOut, easeIn, easeOut）\n- [x] Support Interface Builder\n- [x] Support `Swift3`\n- [x] And more...\n\n#### [Run example app in your browser](https://appetize.io/app/u8pqek1414r8degeq4u9ttegpg?device=iphone6s\u0026scale=75\u0026orientation=portrait\u0026osVersion=11.0)\n\n## \u003ca name=\"usage\"\u003e Usage\n\n### *1. Frame Size And Center Diff*\nIt is better to set **frame of a UIViewController's view to frame of the donutView**.  \nIf you want to move center point of the donutView, please use `setCenterDiff(CGPoint(x: #X_Diff, y: #Y_Diff))`.  \n\n### *2. Set Configures*\n\n### Inclinations\nIf you want to change the inclinations of DonutView, please use `setCarouselInclination(angleX: #AngleX, angleZ: #AngleZ)`.  \nYou can change it about X and Z angles.  \n\n| **#AngleX = -.pi / 8.0** | **#AngleZ = -.pi / 4.0** |\n|---|---|\n| ![x-pi_8](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/x-pi_8.gif) | ![z-pi_4](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/z-pi_4.gif) |\n\n### Cells Alpha\nIf you want to change the alpha of front or back DonutViewCells, please use `setFrontCellAlpha(#AlphaFront)` or `setBackCellAlpha(#AlphaBack)`.  \n\n| **#AlphaFront = 1.0, #AlphaBack = 0.7** | **#AlphaFront = 0.7, #AlphaBack = 1.0** |\n|---|---|\n| ![f10_b07](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/f10_b07.png) | ![f07_b10](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/f07_b10.png) |\n\n### Selectable\nYou can set whether DonutView is selectable or not by `setSelectableCell(Bool)`.  \nIf the cells is selectable, the selected cell is scrolled to the center.  \n\n### Auto Cell Alignment Center\nYou can set whether the alignment of DonutView is center or not by `setCellAlignmentCenter(Bool)`.  \n\n| **true** | **false** |\n|---|---|\n| ![alignment_center_true](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/alignment_center_true.gif) | ![alignment_center_false](https://raw.githubusercontent.com/cokaholic/ImageAssets/master/Donut/alignment_center_false.gif) |\n\n### Back Cells Interaction Enabled\nYou can set whether the interaction of DonutView's back cells is enable or not by `setBackCellInteractionEnabled(Bool)`.  \n\n### Only Cells Interaction Enabled\nYou can set whether the interaction of DonutView is enable only cells or not by `setOnlyCellInteractionEnabled(Bool)`.  \n\n### Animation Curve\nIf you want to change the animation curve of DonutView, please use `setAnimationCurve(UIViewAnimationCurve)`.  \nYou can set an animation curve from below list.  \n\n```swift\npublic enum UIViewAnimationCurve : Int {\n\n    case easeInOut  // slow at beginning and end\n\n    case easeIn     // slow at beginning\n\n    case easeOut    // slow at end\n\n    case linear\n}\n```\n\n### *3. DonutViewDelegate (if you need)*\nIf you want to know at changed center cell or selected cell, you can use below delegate methods.\n\n```swift\noptional func donutView(_ donutView: DonutView, didChangeCenter cell: DonutViewCell)\noptional func donutView(_ donutView: DonutView, didSelect cell: DonutViewCell)\n```\n\n### *4. Add Cells*\nYou can add one or more cells inherited from DonutViewCell to DonutView.  \n**Attention Please!: Before adding a cell, you need to set the frame size for the added cell!!!**  \nIf you want to add cell, please use `addCell(_ cell: DonutViewCell)` or `addCells(_ cells: [DonutViewCell])`.\n\n```swift\nclass ViewController: UIViewController, DonutViewDelegate {\n  private let donutView = DonutView()\n  \n  override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        donutView.frame = view.bounds                   // It's better\n        donutView.setCenterDiff(CGPoint(x: 0, y: 0))    // Set center diff\n        donutView.setFrontCellAlpha(1.0)                // Set front cells alpha\n        donutView.setBackCellAlpha(0.7)                 // Set back cells alpha\n        donutView.setSelectableCell(true)               // Set selectable\n        donutView.setCellAlignmentCenter(true)          // Set auto cell alignment center\n        donutView.setBackCellInteractionEnabled(false)  // Set back cells interaction\n        donutView.setOnlyCellInteractionEnabled(true)   // Set only cells interaction\n        donutView.setAnimationCurve(.linear)            // Set animation curve\n        donutView.addCells(getCardCells())              // Add cells\n\n        donutView.delegate = self                       // Set delegate\n        view.addSubview(donutView)\n  }\n  \n  // MARK: - DonutViewDelegate\n\n  func donutView(_ donutView: DonutView, didChangeCenter cell: DonutViewCell) {\n      print(\"current center cell: \\(cell)\")\n  }\n\n  func donutView(_ donutView: DonutView, didSelect cell: DonutViewCell) {\n      print(\"selected cell: \\(cell)\")\n  }\n}\n```\n\nSee [Example](https://github.com/cokaholic/Donut/tree/master/Example), for more details.\n\n## \u003ca name=\"requirements\"\u003e Requirements\n\n- Xcode 8.0+\n- Swift 3.0+\n- iOS 9.0+\n\n## \u003ca name=\"installation\"\u003e Installation\n\n### CocoaPods\n\nDonut is available through [CocoaPods](http://cocoapods.org).   \nTo install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"Donut\"\n```\n\n### Carthage\n\nAdd the following line to your `Cartfile`:\n\n```ruby\ngithub \"cokaholic/Donut\"\n```\n\n### Manually\n\nAdd the [Donut](./Donut) directory to your project.\n\n## \u003ca name=\"author\"\u003e Author\n\nKeisuke Tatsumi\n\n- [GitHub](https://github.com/cokaholic)\n- [Facebook](https://www.facebook.com/keisuke.tatsumi.50)\n- [Twitter](https://twitter.com/TK_u_nya)\n- Gmail: nietzsche.god.is.dead@gmail.com\n\n## License\n\nDonut is available under the MIT license.  \nSee the [LICENSE file](https://github.com/cokaholic/Donut/blob/master/LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcokaholic%2Fdonut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcokaholic%2Fdonut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcokaholic%2Fdonut/lists"}