Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone cocos2D中形状的CABASICanization?_Iphone_Xcode_Path_Cocos2d Iphone_Shape - Fatal编程技术网

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动作。也许我只是一个新手,但举个例子,我看不出你做了什么,在你的链接上面的代码里,我知道我真正需要做什么