//
//  PulseAnimation.m
//  TTAnimationExample
//
//  Created by titengjiang on 16/1/18.
//  Copyright 漏 2016骞?sloop. All rights reserved.
//

#import "PulseAnimation.h"

@implementation PulseAnimation

-(void)start
{
        NSArray<NSNumber *> *keyTimes =  @[@0,@0.5,@1];
        CAKeyframeAnimation * transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
        transformAnimation.keyTimes = keyTimes;
    
        CATransform3D beginTransform = CATransform3DScale(_targetView.layer.transform, 1, 1, 1);
        CATransform3D middleTransform = CATransform3DScale(_targetView.layer.transform, 1.05, 1.05, 1.05);
        CATransform3D endTransform = CATransform3DScale(_targetView.layer.transform, 1, 1, 1);
    
        transformAnimation.values = @[[NSValue valueWithCATransform3D:beginTransform],
                                   [NSValue valueWithCATransform3D:middleTransform],
                                  [NSValue valueWithCATransform3D:endTransform]
                                  ];
    
    
    CAAnimationGroup * animationGroup = [[CAAnimationGroup alloc] init];
    animationGroup.animations = @[transformAnimation];
    animationGroup.delegate= self;
    animationGroup.duration = _params.duration;
    [_targetView.layer addAnimation:animationGroup forKey:@""];
    
    
 }

@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com