如何将 CABasicAnimation 转换为 UIView animatewithDuration
How to convert a CABasicAnimation to UIView animatewithDuration
我想将 CABasicAnimation 转换为 UIView animatewithDuration ,如果有可能的话?
这是我迄今为止尝试过的代码
CABasicAnimation *myAni = [CABasicAnimation animationWithKeyPath:@"transform.scale.x"];
myAni.duration = 2.0f;
myAni.fromValue = [NSNumber numberWithFloat:1.0];
myAni.toValue = [NSNumber numberWithFloat:2.0];
[self.myView addAnimation:scaleAnimation forKey:@"myKey"];
进入 [UIView animateWithDuration...
。 (而不是 CABasicAnimation
,我希望它在 animations
块中的 animationWithDuration
中。)
这可能吗?如果可以,怎么做?
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
//I need it here
}
completion:^(BOOL finished){
}];
提前致谢
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
//self.myView.transform = CGAffineTransformMakeScale(2.0,1.0);
self.testview.layer.transform = CATransform3DMakeScale(2.0,1.0,1.0);
}
completion:^(BOOL finished){
}];
我想将 CABasicAnimation 转换为 UIView animatewithDuration ,如果有可能的话?
这是我迄今为止尝试过的代码
CABasicAnimation *myAni = [CABasicAnimation animationWithKeyPath:@"transform.scale.x"];
myAni.duration = 2.0f;
myAni.fromValue = [NSNumber numberWithFloat:1.0];
myAni.toValue = [NSNumber numberWithFloat:2.0];
[self.myView addAnimation:scaleAnimation forKey:@"myKey"];
进入 [UIView animateWithDuration...
。 (而不是 CABasicAnimation
,我希望它在 animations
块中的 animationWithDuration
中。)
这可能吗?如果可以,怎么做?
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
//I need it here
}
completion:^(BOOL finished){
}];
提前致谢
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
//self.myView.transform = CGAffineTransformMakeScale(2.0,1.0);
self.testview.layer.transform = CATransform3DMakeScale(2.0,1.0,1.0);
}
completion:^(BOOL finished){
}];