CABasicAnimation *leftboundsanimation = [CABasicAnimation animationWithKeyPath:@"bounds.size.width"];
leftboundsanimation.fromValue = [NSNumber numberWithFloat:1];
//[NSValue valueWithCGSize:CGSizeMake(1, 20)];
leftboundsanimation.toValue = [NSNumber numberWithFloat:animationrectwidth/2-0.5];
// [NSValue valueWithCGSize:CGSizeMake(animationrectwidth/2-0.5, 20)];
leftboundsanimation.removedOnCompletion = NO;
leftboundsanimation.fillMode = kCAFillModeForwards;
leftboundsanimation.duration = 1.3;
leftboundsanimation.beginTime = 2.7;
CABasicAnimation version :
Comment changer la largeur d'un CALayer avec animation de gauche à droite ?
UIView
其实有直接提供动画方法的。改变一个
view
的宽度: