SpriteKit SKAction easing

前端 未结 2 1089
攒了一身酷
攒了一身酷 2020-12-16 14:00

Well the title gives the question away, how can I apply easing to the SKAction node actions in SpriteKit?

I found that this works:

SKAction *moveActi         


        
2条回答
  •  遥遥无期
    2020-12-16 14:59

    I've been using the SKEase framework: https://github.com/buddingmonkey/SpriteKit-Easing It's as simple to use as the standard SpriteKit Actions and adds all the usual more complex eases, cubic, bounce, elastic, back etc. SpriteKitUtils also adds more complex easing types and some handy SpriteKit utilities: https://github.com/raywenderlich/SKTUtils

    The other option is to roll your own using the custom action method, and pass it a block of code with your custom easing/animation function:

    -(SKAction *)customActionWithDuration:(NSTimeInterval)seconds actionBlock:(void (^)(SKNode *node, CGFloat elapsedTime))block
    

提交回复
热议问题