button rising animation
This commit is contained in:
+9
-1
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user