[swell-foop/arnaudb/wip/gtk4] Use constants for animation lengths



commit b9bf071c612d7c1d06f0a9104ec06ded8ca7afea
Author: Robert Roth <robert roth bee-tf ro>
Date:   Thu May 21 15:55:48 2020 +0300

    Use constants for animation lengths

 src/game-view.vala | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index 974eeb2..474e88f 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -434,6 +434,9 @@ private class TileView : Widget
 
     internal FixedLayoutChild child_layout { private get; internal set; }
 
+    private static uint8 ZEALOUS_ANIMATION = 12;
+    private static uint8 STANDARD_ANIMATION = 30;
+
     private bool tile_destroyed = false;
 
     internal TileView (Tile tile, uint size)
@@ -499,7 +502,7 @@ private class TileView : Widget
             remove_controller ((!) click_controller);
         remove_css_class ("highlight");
         add_css_class ("removed");
-        Timeout.add (is_zealous ? 240 : 420, () => { hide (); return Source.REMOVE; });
+        Timeout.add (is_zealous ? ZEALOUS_ANIMATION * 10: STANDARD_ANIMATION * 10, () => { hide (); return 
Source.REMOVE; });
     }
 
     /* Define how the tile moves */
@@ -508,7 +511,7 @@ private class TileView : Widget
     private float current_y = 0.0f;
     internal void animate_move (float old_x, float old_y, float new_x, float new_y, bool is_zealous = false)
     {
-        Timeout.add (is_zealous ? 240 : 420, () => {
+        Timeout.add (is_zealous ? ZEALOUS_ANIMATION * 10 : STANDARD_ANIMATION * 10, () => {
                 if (tick_id == 0)
                 {
                     current_x = old_x;
@@ -517,7 +520,7 @@ private class TileView : Widget
                 else
                     remove_tick_callback (tick_id);
 
-                uint8 i = is_zealous ? 25 : 40;
+                uint8 i = is_zealous ? ZEALOUS_ANIMATION : STANDARD_ANIMATION;
                 float move_distance_x = (new_x - current_x) / (float) i;
                 float move_distance_y = (new_y - current_y) / (float) i;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]