I am trying to update the anchor property of an element in the update tick, and at first I thought it simply wasn’t working, but then I noticed that if I change the size of the window then it does update. But it only updates when the window is being resized, otherwise nothing happens.
I can see from logging to the console that the values are being updated correctly, they are just not shown until window resize. Is there something I need to/can manually call so that the update happens visually?
How are you updating the anchor? Can you share the code please?
Sure:
MatteScreen.prototype.update = function(dt) {
if(window.matteScreenOpen){
this.openAmount += dt * this.fadeSpeed;
this.openAmount = pc.math.clamp(this.openAmount, 0, 0.5);
this.topMatte.element.anchor.y = 0.5 + this.openAmount;
this.bottomMatte.element.anchor.w = 0.5 - this.openAmount;
if(this.openAmount >= 0.5){
window.matteScreenOpen = false;
}
}
};