summaryrefslogtreecommitdiffhomepage
path: root/examples/web/shapes/shapes_easings_box_anim.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/web/shapes/shapes_easings_box_anim.c')
-rw-r--r--examples/web/shapes/shapes_easings_box_anim.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/examples/web/shapes/shapes_easings_box_anim.c b/examples/web/shapes/shapes_easings_box_anim.c
index 0f67d51..4def3ed 100644
--- a/examples/web/shapes/shapes_easings_box_anim.c
+++ b/examples/web/shapes/shapes_easings_box_anim.c
@@ -39,14 +39,14 @@ int framesCounter = 0;
void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
-// Main Enry Point
+// Program Main Entry Point
//----------------------------------------------------------------------------------
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings box anim");
-
+
// Box variables to be animated with easings
rec = (Rectangle){ GetScreenWidth()/2, -100, 100, 100 };
@@ -55,7 +55,7 @@ int main()
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -64,7 +64,7 @@ int main()
#endif
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
@@ -83,12 +83,12 @@ void UpdateDrawFrame(void)
case 0: // Move box down to center of screen
{
framesCounter++;
-
+
// NOTE: Remember that 3rd parameter of easing function refers to
// desired value variation, do not confuse it with expected final value!
rec.y = EaseElasticOut(framesCounter, -100, GetScreenHeight()/2 + 100, 120);
- if (framesCounter >= 120)
+ if (framesCounter >= 120)
{
framesCounter = 0;
state = 1;
@@ -99,8 +99,8 @@ void UpdateDrawFrame(void)
framesCounter++;
rec.height = EaseBounceOut(framesCounter, 100, -90, 120);
rec.width = EaseBounceOut(framesCounter, 100, GetScreenWidth(), 120);
-
- if (framesCounter >= 120)
+
+ if (framesCounter >= 120)
{
framesCounter = 0;
state = 2;
@@ -110,8 +110,8 @@ void UpdateDrawFrame(void)
{
framesCounter++;
rotation = EaseQuadOut(framesCounter, 0.0f, 270.0f, 240);
-
- if (framesCounter >= 240)
+
+ if (framesCounter >= 240)
{
framesCounter = 0;
state = 3;
@@ -121,8 +121,8 @@ void UpdateDrawFrame(void)
{
framesCounter++;
rec.height = EaseCircOut(framesCounter, 10, GetScreenWidth(), 120);
-
- if (framesCounter >= 120)
+
+ if (framesCounter >= 120)
{
framesCounter = 0;
state = 4;
@@ -132,7 +132,7 @@ void UpdateDrawFrame(void)
{
framesCounter++;
alpha = EaseSineOut(framesCounter, 1.0f, -1.0f, 160);
-
+
if (framesCounter >= 160)
{
framesCounter = 0;
@@ -141,7 +141,7 @@ void UpdateDrawFrame(void)
} break;
default: break;
}
-
+
// Reset animation at any moment
if (IsKeyPressed(KEY_SPACE))
{
@@ -152,7 +152,7 @@ void UpdateDrawFrame(void)
framesCounter = 0;
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
@@ -160,7 +160,7 @@ void UpdateDrawFrame(void)
ClearBackground(RAYWHITE);
DrawRectanglePro(rec, (Vector2){ rec.width/2, rec.height/2 }, rotation, Fade(BLACK, alpha));
-
+
DrawText("PRESS [SPACE] TO RESET BOX ANIMATION!", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
EndDrawing();