29,031
社区成员
发帖
与我相关
我的任务
分享
UIView * animationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
animationView.backgroundColor = [UIColor greenColor];
[self.view addSubview:animationView];
animationView.center = self.view.center;
CABasicAnimation *animation = [CABasicAnimation animation];
animation.keyPath = @"transform.scale";
animation.duration = 1.0;
animation.fromValue = @(1.0);
animation.toValue = @(0.1);
animation.autoreverses = YES;
animation.repeatCount = HUGE_VALF;
[animationView.layer addAnimation:animation forKey:nil];