I tried to show gif only one time. So I used this code to achieve this.
var ui_img = document.getElementById("ui_image");
ui_img.hidden = false;
setTimeout(function () {
ui_img.hidden = true;
}, 8000);
But I knew the all gifs do not have the same duration. How can I solve this?