//
//  LSCircleView.m
//  LSColorExtracta
//
//  Created by Dylan on 2018/11/7.
//  Copyright © 2018 Yang. All rights reserved.
//

#import "LSCircleView.h"

#define animationDuration 0.25

@interface LSCircleView ()


@end



@implementation LSCircleView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.layer.cornerRadius = 20;
        self.layer.masksToBounds = YES;
        self.layer.borderWidth = 3;
        self.layer.borderColor = [UIColor whiteColor].CGColor;
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}



-(void)styleCenter:(CGPoint)center style:(StyleType)style color:(UIColor*)color {
    
    switch (style) {
        case StyleTypeRound:{
            
            [UIView animateWithDuration:animationDuration animations:^{
                [self setFrame:CGRectMake(center.x-20, center.y-20, 40, 40)];
                self.layer.cornerRadius = 20;
                self.layer.masksToBounds = YES;
                self.layer.borderWidth = 3;
                self.layer.borderColor = [UIColor whiteColor].CGColor;
                self.backgroundColor = color;
            } completion:^(BOOL finished) {
                
            }];
        }
            break;
        case StyleTypeCircle: {
            
            [UIView animateWithDuration:animationDuration animations:^{
                [self setFrame:CGRectMake(center.x-50, center.y-50, 100, 100)];
                self.layer.cornerRadius = 50;
                self.layer.masksToBounds = YES;
                self.layer.borderWidth = 15;
                self.layer.borderColor = color.CGColor;
                self.backgroundColor = [UIColor clearColor];
            } completion:^(BOOL finished) {
                
            }];
        }
            break;
            
        default:
            break;
    }
}




@end

