我想为像弹跳的图像制作动画.我能够将它向前弹回但我无法将其推回去.我正在使用此代码:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0f];
hair.transform = CGAffineTransformMakeScale(3.0, 3.0);
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
请帮帮我..我现在是结构而且无法解决这个问题.请帮帮我.
使用这几行代码来动画像弹跳一样的图像.
imgView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
//imgView is your UIImageView where you set an image
[self.view addSubview:imgView];
[UIView animateWithDuration:0.3/1.5 animations:^{
imgView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3/2 animations:^{
imgView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3/2 animations:^{
imgView.transform = CGAffineTransformIdentity;
}];
}];
}];
Run Code Online (Sandbox Code Playgroud)
谢谢
归档时间: |
|
查看次数: |
4279 次 |
最近记录: |