{"id":13849083,"url":"https://github.com/dulacp/DPMeterView","last_synced_at":"2025-07-12T15:32:54.332Z","repository":{"id":7140475,"uuid":"8437492","full_name":"dulacp/DPMeterView","owner":"dulacp","description":"Gravity-aware gauge-style meter view with delightful animations","archived":false,"fork":false,"pushed_at":"2017-12-02T13:42:53.000Z","size":761,"stargazers_count":577,"open_issues_count":1,"forks_count":82,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-11-12T20:13:20.699Z","etag":null,"topics":["gauge","gravity","ios","objective-c"],"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/dulacp.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":"2013-02-26T17:09:10.000Z","updated_at":"2024-09-10T15:01:31.000Z","dependencies_parsed_at":"2022-09-07T23:31:39.315Z","dependency_job_id":null,"html_url":"https://github.com/dulacp/DPMeterView","commit_stats":null,"previous_names":["dulaccc/dpmeterview"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulacp%2FDPMeterView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulacp%2FDPMeterView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulacp%2FDPMeterView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulacp%2FDPMeterView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dulacp","download_url":"https://codeload.github.com/dulacp/DPMeterView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225829291,"owners_count":17530663,"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":["gauge","gravity","ios","objective-c"],"created_at":"2024-08-04T19:01:07.506Z","updated_at":"2024-11-22T01:30:25.051Z","avatar_url":"https://github.com/dulacp.png","language":"Objective-C","funding_links":[],"categories":["Objective-C"],"sub_categories":[],"readme":"# DPMeterView\n**Presents values in a custom gauge-style meter view with delightful animations**\n\n[![Build Status](https://img.shields.io/travis/dulacp/DPMeterView.svg?branch=master)](https://travis-ci.org/dulacp/DPMeterView)\n\n\u003e It should be easy to fill a shape with a color, to visually reflect a percentage.\n\nThere is plenty of examples where it can be useful: \n\n* simple progress bar view\n* stars rating view\n* emotion view\n* trend value view\n\n![iPhone portrait](Screenshots/iphone-portrait.png)\n\n## Requirements\n\nMinimal iOS Target: iOS 5\n\n## CocoaPods\n\n\u003e Instead of adding the source files directly to your project, you may want to consider using [CocoaPods](http://cocoapods.org/) to manage your dependencies. Follow the instructions on the CocoaPods site to install the gem, and specify DPMeterView as a dependency in your `Podfile` with\n\n```ruby\npod 'DPMeterView', '0.0.1'\n```\n\n## Run the Demo\n\nClone the repo and install CocoaPods dependencies.\n\n```sh\n$ git clone https://github.com/dulacp/DPMeterView.git\n$ cd DPMeterView/Example\n$ pod install\n$ open Example.xcworkspace\n```\n\nThen select the correct active scheme `Example` (if something else like `Pod` or `Pod-DPMeterViewTests` was selected).\nAnd your good to run the app on the Simulator or a Device.\n\n## Usage\n\n```objective-c\n#import \"DPMeterView.h\"\n#import \"UIBezierPath+BasicShapes.h\"\n\nDPMeterView *fiveStarsShape = [[DPMeterView alloc] init];\n[fiveStarsShape setFrame:CGRectMake(0, 0, 200, 40)];\n[fiveStarsShape setMeterType:DPMeterTypeLinearHorizontal];\n[fiveStarsShape setShape:[UIBezierPath stars:5 shapeInFrame:fiveStarsShape.bounds].CGPath];\n```\n\n#### setProgress:animated:\n\n```objective-c\n[fiveStarsShape setProgress:0.6 animated:YES];\n```\n\nAnd a nice animation will update the view.\n\n### Custom shapes\n\n\u003e Not a single image pixel !\n\nIn the example above I'm just using a `UIBezierPath` that is included in the category `UIBezierPath+BasicShapes`. Feel free to fork the project and add other shapes you think it'd be great to have.\n\nYou can use any shape you want, the class `DPMeterView` uses the `CGPath` as a mask.\n\n### Gravity aware\n\n\u003e to try this feature you need to run the `Example` project on a device because the simulator doesn't provide `CoreMotion` acceleration data.\n\n![iPhone portrait](Screenshots/iphone-with-gravity.png)\n\n#### startGravity\n\n```objective-c\n[fiveStarsShape startGravity];\n```\n#### stopGravity\n\n```objective-c\n[fiveStarsShape stopGravity];\n```\n\n## Minor known issues\n\n* The `yaw` obtained from the `CoreMotion` acceleration quaternion is restrained to the interval `[-PI/2, PI/2]`, because of the definition of `arcsin` used to compute it. It would be even better if we find a way to extend it to the complete interval `[-PI, PI]`\n* There will be some boudary issues with gradients that have an oriented angle other that a vertical or an horizontal one. Especially, a `DPMeterView` shape can be entirely filled whereas it is not at a 100% progression, depends on the shape… \n\n## Roadmap / Evolutions\n \n* Have a `progressTintColor` that can evolve with the `progress` value, like in a [heat map scale](http://www.energyvanguard.com/Portals/88935/images/home-energy-rating-hers-index-scale-resized-600.jpg).\n* Use an image for the mask instead of a CGPath, but I don't know how to achieve that.\n* I'd like to add a little utility that enables developers to load shapes from  a `.svg` file into a `UIBezierPath` directly, avoiding the burden of creating a UIBezierPath by hand. (the current work around is to use the great [PaintCode](http://www.paintcodeapp.com/) application)\n\n## Contact\n\n[Pierre Dulac](http://github.com/dulacp)  \n[@\\_dulacp](https://twitter.com/_dulacp)\n\n## License\nDPMeterView 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%2Fdulacp%2FDPMeterView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdulacp%2FDPMeterView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdulacp%2FDPMeterView/lists"}