https://github.com/johnvuko/jtborderdotanimation
A simple animation with dots turning around a UIView for iOS
https://github.com/johnvuko/jtborderdotanimation
Last synced: about 1 year ago
JSON representation
A simple animation with dots turning around a UIView for iOS
- Host: GitHub
- URL: https://github.com/johnvuko/jtborderdotanimation
- Owner: johnvuko
- License: mit
- Created: 2014-11-28T12:42:26.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-30T16:36:20.000Z (about 11 years ago)
- Last Synced: 2025-04-06T21:02:19.371Z (about 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 208 KB
- Stars: 56
- Watchers: 8
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JTBorderDotAnimation
[](https://travis-ci.org/jonathantribouharet/JTBorderDotAnimation)



JTBorderDotAnimation is a simple animation for have dots turning around a UIView on iOS.
## Installation
With [CocoaPods](http://cocoapods.org/), add this line to your Podfile.
pod 'JTBorderDotAnimation', '~> 1.0'
## Screenshots

## Usage
### Basic usage
Just import `JTBorderDotAnimation.h`.
```objective-c
#import "JTBorderDotAnimation.h"
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIView *animatedView;
@property (strong, nonatomic) JTBorderDotAnimation *dotAnimation;
@end
```
Assign the view you want to animate and start the animation.
```objective-c
- (void)viewDidLoad
{
[super viewDidLoad];
self.dotAnimation = [JTBorderDotAnimation new];
self.dotAnimation.animatedView = self.animatedView;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.dotAnimation start];
}
```
### Customization
You can easily customize the animation.
- `numberPoints`
- `duration`
- `repeatCount`
- `pointSize`
- `pointColor`
Example:
```objective-c
- (void)viewDidLoad
{
[super viewDidLoad];
self.dotAnimation = [JTBorderDotAnimation new];
self.dotAnimation.animatedView = self.animatedView;
self.dotAnimation.numberPoints = 6;
self.dotAnimation.duration = 6.;
self.dotAnimation.repeatCount = 3;
self.dotAnimation.pointSize = 5.;
self.dotAnimation.pointColor = [UIColor orangeColor];
}
```
### Notes
`clipsToBounds` property of the animatedView is set to `NO` at the beginning of the animation.
You can also change the speed of the animation without stopping it with:
```objective-c
CALayer *layer = self.animatedView.layer;
layer.timeOffset = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
layer.beginTime = CACurrentMediaTime();
layer.speed = 2.;
```
## Requirements
- iOS 7 or higher
- Automatic Reference Counting (ARC)
## Known Issues
- Animation stop when the application go in background, you have to restart it manually
## Author
- [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
## License
JTBorderDotAnimation is released under the MIT license. See the LICENSE file for more info.