小编Chr*_*ian的帖子

使用CAAnimationGroup对两个核心动画进行分组会导致一个CABasicAnimation无法运行

我有两个动画,我试图在iPhone上使用OS 3.1.2在UILabel上执行.第一个来回摇晃UILabel:

CAKeyframeAnimation *rock;
rock = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
[rock setBeginTime:0.0f];
[rock setDuration:5.0];
[rock setRepeatCount:10000];

NSMutableArray *values = [NSMutableArray array];
MovingMath *math = [[MovingMath alloc] init];

// Center start position
[values addObject:[math DegreesToNumber:0]];

// Turn right
[values addObject:[math DegreesToNumber:-10]];

// Turn left
[values addObject:[math DegreesToNumber:10]];

// Re-center
[values addObject:[math DegreesToNumber:0]];

// Set the values for the animation
[rock setValues:values];

[math release];
Run Code Online (Sandbox Code Playgroud)

第二个缩放UILabel使其变大:

NSValue *value = nil;
CABasicAnimation *animation = nil;
CATransform3D transform;
animation = [CABasicAnimation animationWithKeyPath:@"transform"];
transform = CATransform3DMakeScale(3.5f, 3.5f, 1.0f); …
Run Code Online (Sandbox Code Playgroud)

iphone core-animation

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

core-animation ×1

iphone ×1