How to update Phaser.Tweens.Tween.loop dynamically?

I want to change the loop of a tween dynamically, while the tween is playing
I tried using function for the loop with no success :frowning_face:

this.loops = 2

this.tween = this.scene.tweens.add({
  targets: this,
  duration: 1500,
  loop: () => {
    return this.loops
  },
  onLoop: () => {
    if (this.loops < 10) {
      this.loops++
    }
  },
})

also, I tried using updateTo

this.tween.updateTo('loop', this.loops, false)

any help?
Thanks

Hi, try with:

this.loops = 2;
this.tween = this.scene.tweens.add({
  targets: this,
  duration: 1500,
  loop:1,
  onLoop: () => {
    if (this.loops < 10) {
      this.loops++;
      this.tween.restart();
    }
  },
})