我想在Cocos2D中使用这个核心动画代码,或者我只想得到相同的结果。我怎样才能将它翻译成cocos 2D:
CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
pulseAnimation.duration = 1.0;
pulseAnimation.toValue = [NSNumber numberWithFloat:1.1];
pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pulseAnimation.autoreverses = YES;
pulseAnimation.repeatCount = FLT_MAX;
CALayer *layer = centre.layer;
[layer addAnimation:pulseAnimation forKey:nil];
谢谢。为我的英语而烦恼我是法国人:/
答案 0 :(得分:0)
id scl = [CCScaleTo actionWithDuration:1 scale:1.1];
id action = [CCSequence actionOne:scl two:[scl reverse]];
[YOUR_CCOBJECT runAction:action];
这是单脉冲的代码(缩放到110%然后回到100%)
有[action setRepeatCount:YOUR_COUNT];
但我自己没试过。