How to use the synchronization function to slowly accelerate the zoom function using SpriteKit

I have a sprite that I am trying to scale. I use scaleTo skaction to do this ... I want it to decrease slowly. And that was my initial decision:

    let scal = SKAction.scale(by: 100, duration: 10)
    scal.timingMode = SKActionTimingMode.easeIn

The problem is that since it scales, because it scales so much that it slows down. Therefore, I need to use the timeingFunction function to write a user easeIn procedure for the action.

https://youtu.be/CE-B27gSXJI

In the video you will see that it starts fast and slows down. This only appears because I go to the scale, and the more you slow down, the more it appears ...

Problem: I have no idea how to do this with the synchronization function, and I could not find a good source to use as a link?

Any help would be appreciated and appreciated.

+4
source share
2 answers

Take a look at Ray Wenderlichโ€™s Sprite Kit Utils for an example of how to write an attenuation function: https://github.com/raywenderlich/SKTUtils In particular, look at SKTTimingFunctions.swift and SKTEffects.swift.

, . , , , . , , http://easings.net

, !

+3

, , , .

, , timingFunction, "t " . .

, , , , Ray SKTTimingFunctions.swift.

, ; , ... , .

let scal = SKAction.scale(by: 100, duration: 10)
scal.timingFunction = { t in
    return t*t*t*t*t
}
+2

Source: https://habr.com/ru/post/1684179/


All Articles