activate animation for a moment with javascript

hi guys, i’m building a little app and i need to handle javascript error or success and showing them in the ui for a time like 2s

function sendMessage(){
        messages.save({
            message: "joyeux anniversai",
            senderid: "houhou",
            receiverid: "haha",
            rooms: chatRooms

        }, {
            success: function(messages) {
                console.log('messages sended')
                // Do something and show file as been saved
            },
            error: function(messages, error) {
                console.log('error sending the message')
                // The save failed.
                // Do something and show that it failed to save the file
            }
        })
        }

i have a WhileTrue condition that i need to activate when something is saved or not

<WhileTrue ux:Name="lou">
    <Change loudou.Opacity="1"/>
</WhileTrue>

so i need to activate this condition for 2 secondes , how can i do this.

You can use the timer API for this. (Currently missing from the new docs so the link is for the old one. We’ll get that fixed as well).

Basically, the function that enables/shows the message can then also set up a timer to remove it again after 2 seconds.

its working perfectly , thank you