Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/facebookarchive/Shimmer
An easy way to add a simple, shimmering effect to any view in an iOS app.
https://github.com/facebookarchive/Shimmer
Last synced: 15 days ago
JSON representation
An easy way to add a simple, shimmering effect to any view in an iOS app.
- Host: GitHub
- URL: https://github.com/facebookarchive/Shimmer
- Owner: facebookarchive
- License: other
- Archived: true
- Created: 2014-02-18T22:15:19.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2021-02-06T00:01:46.000Z (almost 4 years ago)
- Last Synced: 2024-05-29T02:23:17.788Z (7 months ago)
- Language: Objective-C
- Homepage:
- Size: 2.64 MB
- Stars: 9,346
- Watchers: 363
- Forks: 1,110
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-ios - Shimmer - An easy way to add a simple, shimmering effect to any view in an iOS app. (UI / Animation)
README
# Shimmer
Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator.Shimmer was originally developed to show loading status in [Paper](http://facebook.com/paper).
![Shimmer](https://github.com/facebook/Shimmer/blob/master/shimmer.gif?raw=true)
## Usage
To use Shimmer, create a `FBShimmeringView` or `FBShimmeringLayer` and add your content. To start shimmering, set the `shimmering` property to `YES`.An example of making a label shimmer:
```objective-c
FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:shimmeringView];UILabel *loadingLabel = [[UILabel alloc] initWithFrame:shimmeringView.bounds];
loadingLabel.textAlignment = NSTextAlignmentCenter;
loadingLabel.text = NSLocalizedString(@"Shimmer", nil);
shimmeringView.contentView = loadingLabel;// Start shimmering.
shimmeringView.shimmering = YES;
```There's also an example project. In the example, you can swipe horizontally and vertically to try various shimmering parameters, or tap to start or stop shimmering. (To build the example locally, you'll need to open `FBShimmering.xcworkpace` rather than the `.xcodeproj`.)
## Installation
There are two options:1. Shimmer is available as `Shimmer` in [Cocoapods](http://cocoapods.org).
2. Manually add the files into your Xcode project. Slightly simpler, but updates are also manual.Shimmer requires iOS 6 or later.
## How it works
Shimmer uses the `-[CALayer mask]` property to enable shimmering, similar to what's described in John Harper's 2009 WWDC talk (unfortunately no longer online). Shimmer uses CoreAnimation's timing features to smoothly transition "on-beat" when starting and stopping the shimmer.## Other Platforms
We have a version of Shimmer for Android, too! It's [also available on GitHub](https://github.com/facebook/shimmer-android).
## Contributing
See the CONTRIBUTING file for how to help out.## License
Shimmer is BSD-licensed.