动画在图层上的另一个问题是使其按比例缩放并显示为从左下角开始增长,有点类似于该图:

---------------
|             |
|----------   |
|         |   |
|         |   |
|-----    |   |
|    |    |   |
---------------

我尝试了一些动画,但无法完全按照我想要的方式实现。
请提出建议。当前正在使用以下代码进行缩放:
layer.anchorPoint = CGPointMake(1, 1);
CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
[scale setFromValue:[NSNumber numberWithFloat:0.0f]];
[scale setToValue:[NSNumber numberWithFloat:1.0f]];
[scale setDuration:1.0f];
[scale setRemovedOnCompletion:NO];
[scale setFillMode:kCAFillModeForwards];

最佳答案

您应该设置一个不同的anchorPoint来实现该效果。

    layer.anchorPoint = CGPointMake(0.0f, 1.0f);

关于ios - CALayer缩放动画,用于从左下到右上的图层大小,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9837384/

10-13 06:20