Tweek. Loading animation

Hello! I couldn’t fully understand how “Tween” works.

I want to rotate this image by 45 degrees, every 0.5 seconds, without stopping and without intermediate frames.
loading

// This is just for example
start() {
   tween(this.node)
   .delay(0.5)
   .by(0, {rotation : ???})
   .repeatForever()
   .start()
}

As I understand it, this cannot be done using regular animation. I found a more flexible way is “Tween”.
But my experiments were not crowned with success. Sometimes a node simply disappeared somewhere or an “[Action update] error appeared. override me”.

I’m using Cocos Creator version 3.8.1

You should use union() to make former steps into one, then use repeatForever().

        tween(this.target)
            .delay(0.5)
            .by(0, {angle: 45})
            .union()
            .repeatForever()
            .start()
1 Like