Hello,
I’ve a menu with a 2D Screen, an image with a layout group and finally several buttons in children of this group. They are centered on the middle of the screen.
I want to create a tween animation, from the left screen border to their final position :
HomeManager.prototype.postInitialize = function()
{
const startPosition = this.play.getLocalPosition().clone();
this.play.setLocalPosition(new pc.Vec3(-500, startPosition.y, startPosition.z));
this.play.tween(this.play.getLocalPosition()).to(startPosition, 1, pc.BackOut).start();
};
The tween works, however the final position is not correct. It’s certainly because the layout group calculations wasn’t finished, and we have to wait a frame? If I put a setTimeout, no problem.
How to know when calculations is done? I tried with postInitialize but same issue. Can we force calculation or have an event when ready?