[SOLVED] How would I make fading out text?

Hello, all. I am wondering if I can make a text entity that fades out after a certain amount of time. Is there any way to do this?

Hi @Codeknight999!

You can use delta time for this. I expect the text will fade out with the code below in the update function.

// update function
if (this.entity.element.opacity > 0) {
    this.entity.element.opacity -= dt;
}

Please let me know if it works.

How would I change the amount of time it takes to fade out?

You basically can replace dt with every value.

// update function
if (this.entity.element.opacity > 0) {
    this.entity.element.opacity -= 0.1;
}

Thanks a lot!

1 Like