//缩放
- (void)animationScale{
CALayer *layer =[CALayer layer];
layer.bounds = CGRectMake(0, 0, 100, 100);
layer.position = CGPointMake(100,100);
layer.backgroundColor = [UIColor yellowColor].CGColor;
[self.view.layer addSublayer:layer];
CABasicAnimation *animation = [CABasicAnimation animation];
animation.keyPath = @"bounds";
// toValue 到达哪个点,byValue是增加多少值,fromValue 从哪个点开始移动
animation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 50, 50)];
animation.duration = 2;
animation.removedOnCompletion = NO;
animation.fillMode = @"forwards";
[layer addAnimation:animation forKey:nil];
}
文章标题
最新推荐文章于 2023-10-19 15:03:50 发布