|
//
// ZSAnimationView.m
// AnimationDemo
//
// Created by zhousan on 15/9/18.
// Copyright © 2015年 zhousan. All rights reserved.
//
#import "ZSAnimationView.h"
@implementation ZSAnimationView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.layer.cornerRadius = 1;
self.clipsToBounds = YES;
}
return self;
}
- (void)animationStartWithOffsetX:(CGFloat)offsetX {
CGRect rect = self.frame;
rect.origin.x = offsetX;
[[UIApplication sharedApplication]beginIgnoringInteractionEvents];
[UIView animateWithDuration:0.3 animations:^{
self.frame = rect;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
self.layer.transform = CATransform3DScale(self.layer.transform, 1.2, 1.2, 1.2);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
self.layer.transform = CATransform3DIdentity;
} completion:^(BOOL finished) {
[[UIApplication sharedApplication]endIgnoringInteractionEvents];
}];
}];
}];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
|