所有复杂动画都是由简单动画组合而成的
swift和oc demo
滑动来解锁
动画细节拆分:
1.使用CAGradientLayer处理颜色渐变
-(CAGradientLayer *)gradientLayer{
if (!_gradientLayer) {
_gradientLayer = [CAGradientLayer layer];
_gradientLayer.frame = CGRectMake(-self.bounds.size.width, self.bounds.origin.y, 3
* self.bounds.size.width, self.bounds.size.height);
_gradientLayer.startPoint = CGPointMake(0, 0.5);
_gradientLayer.endPoint = CGPointMake(1.0, 0.5);
_gradientLayer.colors = @[
(__bridge id)[UIColor blackColor].CGColor,
(__bridge id)[UIColor whiteColor].CGColor,
(__bridge id)[UIColor blackColor].CGColor
];
_gradientLayer.locations = @[@0.25,@0.5,@0.75];
}
return _gradientLayer;
}