button rising animation

This commit is contained in:
speckitor
2026-07-07 14:58:50 +07:00
parent 5ab9bac6b0
commit 29bc247757
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -33,12 +33,20 @@ void DrawButton(Button *button, Cube *cube)
if (pressed)
{
button->height = cube->position.y - cube->edge / 2.0f;
if (button->height <= 0.0f)
{
button->height = 0.01f;
}
button->color = RED;
button->pressed = true;
}
else
{
button->height = 0.2f;
button->height += 0.01f;
if (button->height > 0.1f)
{
button->height = 0.1f;
}
button->color = BLUE;
button->pressed = false;
}
+1 -1
View File
@@ -7,7 +7,7 @@
#include <stdio.h>
Button button = {
.position = (Vector3){0.0f, 0.0f, 0.0f},
.position = (Vector3){0.0f, 0.0f, -5.0f},
.length = 1.0f,
.height = 0.1f,
.color = BLUE,