Iphone cocos2D中形状的CABASICanization?
这是我的代码:Iphone cocos2D中形状的CABASICanization?,iphone,xcode,path,cocos2d-iphone,shape,Iphone,Xcode,Path,Cocos2d Iphone,Shape,这是我的代码: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"]; animation.duration = 2.0; animation.repeatCount = HUGE_VALF; animation.autoreverses = YES; animation.timingFunction = [CAMediaTimingFunction functionWithName:k
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"];
animation.duration = 2.0;
animation.repeatCount = HUGE_VALF;
animation.autoreverses = YES;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.fromValue = (id)boxPath;
animation.toValue = (id)roundPath;
[shapeLayer addAnimation:animation forKey:@"animatePath"];
`
我在UIKIT应用程序中使用了这段代码,但现在我想在cocos2D上使用它,有没有办法呢?请:)对不起,我的英语是法语:/你想把一个精灵移到一个地方,然后再移回到你开始的地方吗??? 如果要执行此操作,请执行以下代码:
id move = [CCMoveTo actionWithDuration:time position:ccp(x,y)];
[sprite runAction:[CCRepeatForever actionWithAction:[CCSequence actions:move, [move reverse], nil]]];
是否只创建帧动画?如果是这样,cocos2d中就有cAnimate操作。你可以用你的帧初始化cAnimation对象,设置动画持续时间,然后从这个动画中创建cAnimate动作。也许我只是一个新手,但举个例子,我看不出你做了什么,在你的链接上面的代码里,我知道我真正需要做什么