我基本上希望动作正在运行,然后在动作的中间创建一个慢动作效果,然后将其从慢动作中解脱出来.有没有人有什么好的反馈如何这样做?我已经考虑过手动创建操作并使用更新方法,但我觉得这可能是过度的.我希望得到一个更简单的解决方案.
另一个想法是停止这个动作,然后在较慢的时间内重新开始,但是我不认为它会保持在相同的路径上,它可能看起来很奇怪.
这是我用来创建动作的代码.
CGMutablePathRef cgpath = CGPathCreateMutable(); CGPathMoveToPoint(cgpath,NULL,mysprite.position.x,mysprite.position.y); CGPathAddCurveToPoint(cgpath,cp1.x,cp1.y,cp2.x,cp2.y,e.x,e.y); [mysprite runAction:[SKAction sequence:@[[SKAction followPath:cgpath asOffset:NO orientToPath:YES duration:3]]]]; CGPathRelease(cgpath);
解决方法
每个节点具有速度属性:
A speed modifier applied to all actions executed by a node and its
descendants.Discussion
The default value is 1.0,which means that all actions run
at their normal speed. If you set a different speed,time appears to
run faster or slower for all actions executed on the node and its
descendants. For example,if you set a speed value of 2.0,actions run
twice as fast.
您可以将其设置为小于1的值,以使操作更慢.甚至可以动画速度逐渐减慢:
[mySprite runAction:[SKAction speedTo:0.5 duration:1.0]];