From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.m | 88 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.m b/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.m new file mode 100755 index 0000000..e6202bb --- /dev/null +++ b/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/PageControl/TAAnimatedDotView.m @@ -0,0 +1,88 @@ +// +// TAAnimatedDotView.m +// TAPageControl +// +// Created by Tanguy Aladenise on 2015-01-22. +// Copyright (c) 2015 Tanguy Aladenise. All rights reserved. +// + +#import "TAAnimatedDotView.h" + +static CGFloat const kAnimateDuration = 1; + +@implementation TAAnimatedDotView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initialization]; + } + + return self; +} + + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initialization]; + } + return self; +} + + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) { + [self initialization]; + } + + return self; +} + +- (void)setDotColor:(UIColor *)dotColor +{ + _dotColor = dotColor; + self.layer.borderColor = dotColor.CGColor; +} + +- (void)initialization +{ + _dotColor = [UIColor whiteColor]; + self.backgroundColor = [UIColor clearColor]; + self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2; + self.layer.borderColor = [UIColor whiteColor].CGColor; + self.layer.borderWidth = 2; +} + + +- (void)changeActivityState:(BOOL)active +{ + if (active) { + [self animateToActiveState]; + } else { + [self animateToDeactiveState]; + } +} + + +- (void)animateToActiveState +{ + [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:-20 options:UIViewAnimationOptionCurveLinear animations:^{ + self.backgroundColor = _dotColor; + self.transform = CGAffineTransformMakeScale(1.4, 1.4); + } completion:nil]; +} + +- (void)animateToDeactiveState +{ + [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:0 options:UIViewAnimationOptionCurveLinear animations:^{ + self.backgroundColor = [UIColor clearColor]; + self.transform = CGAffineTransformIdentity; + } completion:nil]; +} + +@end -- Gitblit v1.8.0