[UIView animateWithDuration:1 animations:^{
// 要执行的动作
}];
[UIView animateWithDuration:1 animations:^{
// 改变蓝色方块的位置
CGPoint blueCenter = self.blueSquare.center;// 获取原来的方块中心位置
blueCenter.x = self.view.bounds.size.width - self.blueSquare.center.x;// 改变中心位置的X坐标
self.blueSquare.center = blueCenter;// 设置方块的中心位置到新的位置
}];
[UIView animateWithDuration:1 delay:0.5 options:nil animations:^{
// 改变蓝色方块的位置
CGPoint blueCenter = self.blueSquare.center;// 获取原来的方块中心位置
blueCenter.x = self.view.bounds.size.width - self.blueSquare.center.x;// 改变中心位置的X坐标
self.blueSquare.center = blueCenter;// 设置方块的中心位置到新的位置
} completion:nil];
// 开始透明度动画(一秒完成)
[UIView animateWithDuration:1 animations:^{
// 透明度变为0.1
self.blueSquare.alpha = 0.1;
}];
// 进行一秒钟的动画
[UIView animateWithDuration:1 animations:^{
self.blueSquare.transform = CGAffineTransformMakeScale(2.0, 2.0);// 长和宽分别变成原来的两倍
}];
// 改变颜色
[UIView animateWithDuration:1 animations:^{
self.blueSquare.backgroundColor = [UIColor redColor];
}];
[UIView animateWithDuration:1 animations:^{
self.wheelImg.transform = CGAffineTransformMakeRotation(M_PI);
}];
[UIView animateWithDuration:1 animations:^{
self.wheelImg.transform = CGAffineTransformMakeRotation(2*M_PI);
}];
// 持续旋转动画
- (void)spin {
// options属性设置可以让其顺畅地循环转动,completion让其不断在完成之后调用自己
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
self.wheelImg.transform = CGAffineTransformRotate(self.wheelImg.transform, M_PI);// 第一个参数为开始旋转的角度,第二个为旋转的角度
}completion:^(BOOL finished){// 结束时继续执行
[self spin];
}];
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有