How do i temporarily make a part of my UI visible and then invisible a millisecond after?

How do i temporarily make a part of my UI visible and then invisible a millisecond after?

Did something very similar for hitting a mine. You just need to have a Canvas with a white sprite on it and have a CanvasGroup where you can set the Alpha to 1 on firing and rapidly reduce it down to 0.

This is the script I used

using UnityEngine;
using UnityEngine.UI;  // add to the top
using System.Collections;

public class FlashBang : MonoBehaviour {

	public CanvasGroup myCG;
	private bool flash = false;
	
	void Update ()
	{
		if (flash)
		{
			myCG.alpha = myCG.alpha - Time.deltaTime;
			if (myCG.alpha <= 0)
			{
				myCG.alpha = 0;
				flash = false;
			}
		}
	}
	
	public void MineHit ()
	{
		flash = true;
		myCG.alpha = 1;
	}
}