Skip to content

Instantly share code, notes, and snippets.

@irfanbaysal
Created March 8, 2023 08:15
Show Gist options
  • Save irfanbaysal/057742b9e27749e510ed327df8bbc78d to your computer and use it in GitHub Desktop.
Save irfanbaysal/057742b9e27749e510ed327df8bbc78d to your computer and use it in GitHub Desktop.
Shine Effect with AllInOneShader & DOTween
private void DoShine(Image bgImage)
{
var id = "_ShineLocation";
var bgMat = new Material(bgImage.material);
bgImage.material = bgMat;
bgMat.SetFloat(id, 0f);
_shineSeq?.Kill();
_shineSeq = DOTween.Sequence();
_shineSeq.Append(bgMat.DOFloat(1f, id, 2.5f))
.SetEase(Ease.InSine)
.SetDelay(UnityEngine.Random.Range(1.5f, 2.5f))
.SetLoops(-1, LoopType.Restart);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment