{"id":22018751,"url":"https://github.com/rhcad/shapeanimation-objc","last_synced_at":"2025-07-29T16:13:21.942Z","repository":{"id":142628064,"uuid":"39111753","full_name":"rhcad/ShapeAnimation-ObjC","owner":"rhcad","description":"Vector animation framework in Objective-C based on CoreAnimation for iOS and OS X.","archived":false,"fork":false,"pushed_at":"2015-07-15T03:26:16.000Z","size":1832,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T16:18:12.809Z","etag":null,"topics":["animation-framework"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhcad.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":"2015-07-15T02:26:01.000Z","updated_at":"2021-01-09T05:49:55.000Z","dependencies_parsed_at":"2023-03-14T12:00:22.015Z","dependency_job_id":null,"html_url":"https://github.com/rhcad/ShapeAnimation-ObjC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhcad%2FShapeAnimation-ObjC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhcad%2FShapeAnimation-ObjC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhcad%2FShapeAnimation-ObjC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhcad%2FShapeAnimation-ObjC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhcad","download_url":"https://codeload.github.com/rhcad/ShapeAnimation-ObjC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245081970,"owners_count":20557876,"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-framework"],"created_at":"2024-11-30T05:14:00.325Z","updated_at":"2025-03-23T09:32:30.776Z","avatar_url":"https://github.com/rhcad.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"ShapeAnimation-ObjC\n===================\n\nVector animation framework in Obj-C based on CoreAnimation for iOS and OS X.\nWith it you can easily create various animations.\n\n[![Build Status][travis-image]][travis-url]\n[![BSD License][license-image]][license-url]\n\n[travis-url]: https://travis-ci.org/rhcad/ShapeAnimation-ObjC\n[travis-image]: http://img.shields.io/travis/rhcad/ShapeAnimation-ObjC/master.svg\n[license-url]: LICENSE\n[license-image]: http://img.shields.io/badge/license-BSD-blue.svg\n\n## Features\n\n - Animation extension functions of CALayer and CAShapeLayer.\n - Group animations and cascaded animations using block function.\n - Support gradient fill with animation.\n - Custom animations with custom properties.\n - Helper functions to add image, text and vector shapes.\n - Convenience functions for CGPath, such as construction from SVG path and getting path length.\n - Layer hit-testing and dragging.\n\n## Demos\n\nThere are two demo targets for [iOS](ShapeAnimation_iOSDemo) and [OS X](ShapeAnimation_OSXDemo) respectively\nin the project. You can open the project with Xcode 6.0 or above.\nThe demo target for iOS has [basic animation examples][MasterVC] and [custom animation examples][EllipseVC].\n\n[MasterVC]: ShapeAnimation_iOSDemo/MasterViewController.m\n[EllipseVC]: ShapeAnimation_iOSDemo/EllipseViewController.m\n\n![Stroke Lines](Documentation/strokelines.gif)\n![Move Lines](Documentation/movelines.gif)\n\n![Jumping Ball](Documentation/jumpball.gif)\n![Ellipse with Sliders](Documentation/ellipse_sliders.gif)\n\n![OS X Lines](Documentation/osx_movelines.gif)\n![Rotate Polygons](Documentation/rotatepolygons.gif)\n![Hamburger Button](Documentation/hamburger.gif)\n\n### 1. Stroke lines example\n\n```obj-c\nCGPathRef path = CGPathFromSVGPath(@\"M10,20L150,30 120,250Z\");\nCAShapeLayer *a = [view addShapeLayer:path position:CGPointMake(20, 10)];\n[[CAAnimationGroup group:@[a.strokeEndAnimation, [a lineWidthAnimation:0 to:5]]]apply:^{\n    [a.shakeAnimation apply];\n}];\n```\n\n### 2. Move polygon with gradient fill along path\n\n```obj-c\nCGPathRef path = CGPathFromSVGPath(@\"M120,70 C0,200 150,375 250,220 T500,220\");\nCAShapeLayer *la1 = [view addShapeLayer:CGPathFromSVGPath(@\"M10,20L80,40 20,100Z\")];\nla1.gradient = [SAGradient gradient:@[(id)CGColorFromRGBA(0.5,0.5,0.9,1),\n                                      (id)CGColorFromRGBA(0.9,0.9,0.3,1)]];\n\nSAAnimationPair *a1 = [[la1 moveOnPathAnimation:path] setDuration:1.6];\nSAAnimationPair *a2 = [la1.rotate360Degrees forever];\n[[CAAnimationGroup group:@[a1, a2]].autoreverses.forever apply];\n```\n\n### 3. Draw ellipse with sliders\n\n```obj-c\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    \n    layer_ = [SAAnimationLayer layer:@[@\"rx\", @20, @\"ry\", @20]];\n    layer_.drawBlock = ^(SAAnimationLayer *layer, CGContextRef ctx) {\n        CGFloat rx = [layer getProperty:@\"rx\"], ry = [layer getProperty:@\"ry\"];\n        CGRect rect = SARectWithCenter(layer.center, 2 * rx, 2 * ry);\n        CGContextStrokeEllipseInRect(ctx, rect);\n    };\n    [self.shapeView addSublayer:layer_ frame:self.shapeView.bounds];\n    \n    [self radiusXChanged:self.rxSlider];\n    [self radiusYChanged:self.rySlider];\n}\n\n- (IBAction)radiusXChanged:(UISlider *)sender {\n    [layer_ setProperty:sender.value key:@\"rx\"];\n}\n\n- (IBAction)radiusYChanged:(UISlider *)sender {\n    [layer_ setProperty:sender.value key:@\"ry\"];\n}\n```\n\n### 4. Layer hit-testing and dragging\n\n```obj-c\nview.didTap = ^(SAShapeView *view, CGPoint point) {\n    [view removeSelectionBorders];\n    CALayer *layer = [view hitTestLayer:point];\n    if (layer) {\n        [[layer tapAnimation]apply:^{\n            [view addSelectionBorder:layer];\n        }];\n    }\n};\n__block NSArray *selectedLayers = nil;\nview.didPan = ^(SAShapeView *view, SAPanRecognizer *sender) {\n    if (sender.state == SAGestureBegan) {\n        selectedLayers = view.selectedLayers;\n        [view removeSelectionBorders];\n    }\n    else if (sender.state == SAGestureChanged) {\n        CGPoint translation = [sender translationInView:view];\n        [sender setTranslation:CGPointZero inView:view];\n        for (CALayer *layer in selectedLayers) {\n            [CAAnimation suppressAnimation:^{\n                layer.position = SAPointAdd(layer.position, translation);\n            }];\n        }\n    }\n    else if (sender.state == SAGestureEnded) {\n        [view addSelectionBorders:selectedLayers];\n        selectedLayers = nil;\n    }\n};\n```\n\n## License\n\nShapeAnimation-ObjC is released under a BSD License. See [LICENSE file](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhcad%2Fshapeanimation-objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhcad%2Fshapeanimation-objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhcad%2Fshapeanimation-objc/lists"}