Sprite-kit: Moving an element in circular path

后端 未结 1 1908
一整个雨季
一整个雨季 2021-02-06 02:21

I\'m trying make an element move by the edge of circle.

  • I have created and positioned a circle in the middle of the screen:


        
相关标签:
1条回答
  • 2021-02-06 02:38

    + follow:duration: produce the same effect as follow:asOffset:orientToPath:duration: with both, asOffset and orientToPath parameters set to true.

    About asOffset parameter from the docs:

    If true, the points in the path are relative offsets to the node’s starting position. If false, the points in the node are absolute coordinate values.

    So, you should explicitly set it to false:

    let circularMove = SKAction.follow(circle.CGPath, asOffset: false, orientToPath: true, duration: 5)
    
    0 讨论(0)
提交回复
热议问题