Effect: Gradually increasing color on interaction and restore to original #67
-
How to create the effect where: If players press a button it becomes a bit dark, and the more they press, the darker it gets, and after the player stops clicking for a duration the button turns back to original color. |
Beta Was this translation helpful? Give feedback.
Answered by
KyryloKuzyk
Apr 16, 2024
Replies: 1 comment
-
Something like this: [SerializeField] Image buttonImage;
Sequence colorAnimation;
void Update() {
if (Input.GetMouseButtonDown(0)) {
colorAnimation.Stop();
colorAnimation = Sequence.Create(Tween.Color(buttonImage, Color.black, 1));
}
if (Input.GetMouseButtonUp(0)) {
colorAnimation.Stop();
colorAnimation = Sequence.Create()
.ChainDelay(0.5f)
.Chain(Tween.Color(buttonImage, Color.white, 1));
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
IAFahim
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something like this: