{"id":2339,"url":"https://github.com/hachinobu/SamuraiTransition","last_synced_at":"2025-08-06T16:31:39.321Z","repository":{"id":50548609,"uuid":"74805876","full_name":"hachinobu/SamuraiTransition","owner":"hachinobu","description":"SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.","archived":false,"fork":false,"pushed_at":"2019-06-12T12:46:21.000Z","size":497,"stargazers_count":279,"open_issues_count":1,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-28T20:50:11.268Z","etag":null,"topics":["animation","swift","transition"],"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/hachinobu.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":"2016-11-26T05:06:47.000Z","updated_at":"2024-07-25T06:55:28.000Z","dependencies_parsed_at":"2022-08-20T12:20:44.580Z","dependency_job_id":null,"html_url":"https://github.com/hachinobu/SamuraiTransition","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hachinobu%2FSamuraiTransition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hachinobu%2FSamuraiTransition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hachinobu%2FSamuraiTransition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hachinobu%2FSamuraiTransition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hachinobu","download_url":"https://codeload.github.com/hachinobu/SamuraiTransition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228923710,"owners_count":17992568,"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","swift","transition"],"created_at":"2024-01-05T20:16:11.272Z","updated_at":"2024-12-09T16:31:07.869Z","avatar_url":"https://github.com/hachinobu.png","language":"Swift","funding_links":[],"categories":["UI","Libs","UI [🔝](#readme)"],"sub_categories":["Animation","UI","Other free courses"],"readme":"![SamuraiTransition](https://cloud.githubusercontent.com/assets/1317847/21515399/a0b30e80-cd12-11e6-9170-fb61c0143c17.png)\n\n\nSamuraiTransiton is a ViewController transition framework in Swift.\n\nIt is an animation as if Samurai cut out the screen with a sword.\n\n# transition types\n\n|horizontal|vertical|diaonally|cross|\n|:--:|:--:|:--:|:--:|\n|![horizontalzan](https://user-images.githubusercontent.com/1317847/59350691-ad428600-8d57-11e9-80c5-3099d0d50cad.gif)|![vertical](https://user-images.githubusercontent.com/1317847/59350728-ccd9ae80-8d57-11e9-9290-ab0a7ec39a09.gif)|![diagonally](https://user-images.githubusercontent.com/1317847/59350753-dc58f780-8d57-11e9-932f-8a364288ba9b.gif)|![cross](https://user-images.githubusercontent.com/1317847/59350768-e2e76f00-8d57-11e9-95c1-561a4b1c0d3c.gif)|\n\n|x|jagged|circle|rectangle|\n|:--:|:--:|:--:|:--:|\n|![x](https://user-images.githubusercontent.com/1317847/59350778-e8dd5000-8d57-11e9-892d-8b3fd7908436.gif)|![jagged](https://user-images.githubusercontent.com/1317847/59350777-e8dd5000-8d57-11e9-87f5-76f80acc134b.gif)|![circle](https://user-images.githubusercontent.com/1317847/59350779-e8dd5000-8d57-11e9-8e02-c73906579d2d.gif)|![rectangle](https://user-images.githubusercontent.com/1317847/59350780-e8dd5000-8d57-11e9-9433-c971529bac8e.gif)|\n\n|triangle|shredded|chopped|\n|:--:|:--:|:--:|\n|![triangle](https://user-images.githubusercontent.com/1317847/59350781-e975e680-8d57-11e9-8e0e-0d44641d878c.gif)|![shredded](https://user-images.githubusercontent.com/1317847/59350792-eda20400-8d57-11e9-9fa1-630793735446.gif)|![chopped](https://user-images.githubusercontent.com/1317847/59350795-eda20400-8d57-11e9-9a2a-a69113f8324f.gif)|\n\n\n\n\n# Usage\n### Simple\n\n```swift\n\n// make your view controller a subclass of SamuraiViewController\n// present it as normal\n\nimport SamuraiTransition\n\nclass ModalViewController: SamuraiViewController {\n    //...\n}\n\nclass ViewController: UIViewController {\n    \n    @IBAction func horizontalZan(_ sender: Any) {\n        let vc = UIStoryboard(name: \"Main\", bundle: nil).instantiateViewController(withIdentifier: \"ModalViewController\") as! ModalViewController\n        present(vc, animated: true, completion: nil)\n    }\n    \n    @IBAction func verticalZan(_ sender: Any) {\n        let vc = UIStoryboard(name: \"Main\", bundle: nil).instantiateViewController(withIdentifier: \"ModalViewController\") as! ModalViewController\n        // customization\n        vc.samuraiTransition.zan = .vertical\n        present(vc, animated: true, completion: nil)\n    }\n    \n    @IBAction func diagonallyZan(_ sender: Any) {\n        let vc = UIStoryboard(name: \"Main\", bundle: nil).instantiateViewController(withIdentifier: \"ModalViewController\") as! ModalViewController\n        // customization\n        vc.samuraiTransition.zan = .diagonally\n        present(vc, animated: true, completion: nil)\n    }\n\n}\n\n```\n\n### Attributes you can set\n\n```swift\n    //Time of transition\n    public var duration: TimeInterval = 0.33\n    //presenting or not\n    public var presenting = true\n    //horizontal　or vertical or diagonally\n    public var zan = Zan.horizontal\n    //enable or disable affine processing when ModalViewcontroller appears \n    public var isAffineTransform: Bool = true\n    //Passing point of the sword line\n    public var zanPoint: CGPoint?\n    //sword line color\n    public var zanLineColor = UIColor.black\n    //sword line width\n    public var zanLineWidth: CGFloat = 1.0\n\n```\n\n### Custom\n\n```swift\n\nclass ViewController: UIViewController {\n    \n    let transition = SamuraiTransition()\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        transition.duration = 1.0\n        transition.zan = Zan.vertical\n        transition.isAffineTransform = false\n        transition.zanLineColor = .blue\n        transition.zanLineWidth = 2.0\n    }\n\n    @IBAction func tapModalButton(_ sender: AnyObject) {\n        let vc = UIStoryboard(name: \"Main\", bundle: nil).instantiateViewController(withIdentifier: \"ModalViewController\") as! ModalViewController\n        let button = sender as! UIButton\n        transition.zanPoint = CGPoint(x: button.center.x, y: button.center.y)\n//        vc.transitioningDelegate = transition\n        vc.transitioningDelegate = self\n        present(vc, animated: true, completion: nil)\n    }\n\n}\n\nextension ViewController: UIViewControllerTransitioningDelegate {\n    \n    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n        transition.presenting = true\n        return transition\n    }\n    \n    func animationController(forDismissed dismissed: UIViewController) -\u003e UIViewControllerAnimatedTransitioning? {\n        transition.presenting = false\n        return transition\n    }\n    \n}\n\n\n```\n\n# Requirements\n* Xcode 10 or higher\n* iOS 9.0 or higher\n* Swift 5.0\n\n# Installation\n#### [CocoaPods](https://github.com/cocoapods/cocoapods)\n\n`pod 'SamuraiTransition'`\n\n#### [Carthage](https://github.com/Carthage/Carthage)\n\n- Insert `github \"hachinobu/SamuraiTransition\"`\n- Run `carthage update`.\n- Link your app with `SamuraiTransition.framework` in `Carthage/Build`.\n\n# License\nSamuraiTransiton 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%2Fhachinobu%2FSamuraiTransition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhachinobu%2FSamuraiTransition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhachinobu%2FSamuraiTransition/lists"}