CALayer缩放动画的图层大小从左下角到右上角 [英] CALayer scale animation for layer size starting from bottom left to top right
本文介绍了CALayer缩放动画的图层大小从左下角到右上角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
图层上的动画使其缩放并显示为从左下方增长的另一个问题,有点类似于图:
Another problem with animation on a layer to make it scale and show like growing from bottom left, somewhat similar to the figure :
---------------
| |
|---------- |
| | |
| | |
|----- | |
| | | |
---------------
我有尝试了一些动画但不能完全按照我想要的方式实现它。
请建议。目前使用以下代码进行扩展:
I have tried some animations but not able to achieve it exactly the way i want. Please suggest. Currently using following code to scale:
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来实现这种效果。
You should set a different anchorPoint to acheive that effect.
layer.anchorPoint = CGPointMake(0.0f, 1.0f);
这篇关于CALayer缩放动画的图层大小从左下角到右上角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文