图片实现旋转
2019獨角獸企業重金招聘Python工程師標準>>>
---實現圖片3D立體旋轉
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
? ? CABasicAnimation* rotationAnimation;
? ? rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
? ? rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
? ? rotationAnimation.duration = 1;
? ? rotationAnimation.cumulative = YES;
? ? rotationAnimation.repeatCount = MAXFLOAT;
?? ?
? ? [imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
? ?}
?
---圖片旋轉
-(void) startAnimation
{
? ? [UIView beginAnimations:nil context:nil];
? ? [UIView setAnimationDuration:0.01];
? ? [UIView setAnimationDelegate:self];
? ? [UIView setAnimationDidStopSelector:@selector(endAnimation)];
? ? imageView.transform = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
? ? [UIView commitAnimations];
}
?
-(void)endAnimation{
? ? angle += 10;
? ? [self startAnimation];
}
轉載于:https://my.oschina.net/u/2287505/blog/675734
總結
- 上一篇: web服务器防止dos拒绝服务攻击
- 下一篇: spring mvc controlle