button rising animation
This commit is contained in:
+9
-1
@@ -33,12 +33,20 @@ void DrawButton(Button *button, Cube *cube)
|
|||||||
if (pressed)
|
if (pressed)
|
||||||
{
|
{
|
||||||
button->height = cube->position.y - cube->edge / 2.0f;
|
button->height = cube->position.y - cube->edge / 2.0f;
|
||||||
|
if (button->height <= 0.0f)
|
||||||
|
{
|
||||||
|
button->height = 0.01f;
|
||||||
|
}
|
||||||
button->color = RED;
|
button->color = RED;
|
||||||
button->pressed = true;
|
button->pressed = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button->height = 0.2f;
|
button->height += 0.01f;
|
||||||
|
if (button->height > 0.1f)
|
||||||
|
{
|
||||||
|
button->height = 0.1f;
|
||||||
|
}
|
||||||
button->color = BLUE;
|
button->color = BLUE;
|
||||||
button->pressed = false;
|
button->pressed = false;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
Button button = {
|
Button button = {
|
||||||
.position = (Vector3){0.0f, 0.0f, 0.0f},
|
.position = (Vector3){0.0f, 0.0f, -5.0f},
|
||||||
.length = 1.0f,
|
.length = 1.0f,
|
||||||
.height = 0.1f,
|
.height = 0.1f,
|
||||||
.color = BLUE,
|
.color = BLUE,
|
||||||
|
|||||||
Reference in New Issue
Block a user