0
我只是有一个简单的问题。我正在使用CCAnimation通过一系列图像来制作足球螺旋。像这样:动画帮助!
// load the football's animation frames as textures and create a sprite frame
frames = [[NSMutableArray alloc]initWithCapacity:3];
for (int i = 0; i < 10; i++)
{
NSString* file = [NSString stringWithFormat:@"Football%i.png", i];
CCTexture2D* texture = [[CCTextureCache sharedTextureCache] addImage:file];
CGSize texSize = texture.contentSize;
CGRect texRect = CGRectMake(0, 0, texSize.width, texSize.height);
CCSpriteFrame* frame = [CCSpriteFrame frameWithTexture:texture rect:texRect];
[frames addObject:frame];
}
// create an animation object from all the sprite animation frames
CCAnimation* anim = [CCAnimation animationWithFrames:frames delay:0.03f];
// run the animation by using the CCAnimate action
CCAnimate* animate = [CCAnimate actionWithAnimation:anim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:animate];
[self runAction:repeat];
这个作品真的很好,但我想知道我会如何创建与此相同的阵列,这将使足球的样子,慢慢停止转动另一个动画?我知道延迟:0.03f是控制球的旋转速度,所以有一个如何使延迟缓慢地结束在0.0f或有另一种方式来做到这一点?
我做了你说的,但它似乎并不像访问动画。我在这个代码中创建了一个方法[anim setDelay:[anim delay] + 0.1];另一种方法是安排时间,并且全部都在运行,但足球仍在全速前进。我究竟做错了什么? – Stephen 2011-04-01 22:22:59
对不起,我犯了错误,并更正了我的答案,你必须改变你的动画实例的持续时间,而不是动画的延迟,如果你想创建另一个动画,你必须改变延迟,但在你的情况下,它似乎只改变持续时间就够了(这次我自己测试了一下) – Ali1S232 2011-04-03 23:18:54