- (void)circularCharingAnimation
{
if (self.circularStopFlag) return;
[UIView animateWithDuration:2.0 animations:^{
self.circularImageView.alpha = 0.0;
// self.circularImageView.frame = CGRectMake(0, 0, 260.0, 260.0);
// self.circularImageView.center = self.cycleView.center;
//若用上边的写法,测试时在touch 5上运行动画效果会错位
self.circularImageView.frame = CGRectMake(30, -16.5, 260, 260);
} completion:^(BOOL finished) {
NSLog(@"self.circularImageView.frame = %@",NSStringFromCGRect(self.circularImageView.frame));
}];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
self.circularImageView.alpha = 1.0;
self.circularImageView.frame = CGRectMake(0, 0, 184.0, 184.0);
self.circularImageView.center = self.cycleView.center;
[self circularCharingAnimation];
});
}
圆形充电动画实现
本文介绍了一个使用UIView动画创建的圆形充电动画效果。该动画通过改变透明度和位置来模拟充电过程,并利用dispatch_after延迟调用自身形成循环动画。文章详细展示了如何通过Swift代码精确控制动画的每一帧。
1412

被折叠的 条评论
为什么被折叠?



