[!] Looping in color animations is not possible

check this PG https://playground.babylonjs.com/#IY9KM0
The basic bug is that the loop works, but it doesn’t seem to get the animation’s keys.

but check this PG2 https://playground.babylonjs.com/#IY9KM0#1
When you force this to loop, it will loop indefinitely in the form of a while
This means that something is wrong with the scene disposition rules.
(Hit Run on that PG again and look at the devTool’s log)
This is an overall issue with the aniamtion Observable, not the color

i caught the reason for the bug

I’m pretty sure the

    if (this.stopAllAnimations) { // is first 
        this.stopAllAnimations();
    }

is caused by the

this._disposeList(this.animationGroups); // is second

in the scene.dispose() cycle.

The scene’s onDisposeObservable is also a posteriori, so we are also confident in its proof

this.onDisposeObservable.clear(); //is final

@Evgeni_Popov Is there a planned bug in scene.dispose() when reordering animation clears?

Prioritized removal doesn’t seem to have a problem with the scene.dipose() format “for now”
https://playground.babylonjs.com/#IY9KM0#9

Actually, you want to use ANIMATIONLOOPMODE_CYCLE and not ANIMATIONLOOPMODE_CONSTANT. The latter will loop over the last frame of the animation, whereas the former will restart from the start after each loop.

1 Like

that’s worked, I had missed that
Also, I thought it was a loop in the old way except for color, but it was a loop in the wrong way.
That turned out to be a mistake and not reproducible.

So I think the loop resolution is actually removed, but can you check the removal rules for observables as well?

Do you have a repro for this problem?

Also, you should probably create another thread, as this one is now resolved.

1 Like

Related to this

This is an unrelated bug to loop(It may be slightly related in some way)

It looks like a bug related to scene.dispose and between animationGroup and onAnimationGroupEndObservable.
The PG

Press "run"again to reproduce the bug.

Thanks for the repro, here’s the fix:

1 Like

Good enough, thank you