netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=0c8ed945cd42527cc3d1f59e962b62b41b020ca0

commit 0c8ed945cd42527cc3d1f59e962b62b41b020ca0
Author: Alastair Poole <nets...@gmail.com>
Date:   Wed Sep 9 20:41:09 2020 +0100

    ui: that'll do for bolts n clouds......
---
 src/bin/ui/ui_util.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/bin/ui/ui_util.c b/src/bin/ui/ui_util.c
index 1b60596..2978cb6 100644
--- a/src/bin/ui/ui_util.c
+++ b/src/bin/ui/ui_util.c
@@ -505,8 +505,8 @@ _anim_clouds(void *data)
    Ui *ui;
    Animation *anim;
    Evas_Coord ww, wh, iw, ih;
-   time_t t;
    int cpu;
+   time_t t;
    static int bolt = 0;
 
    anim = data;
@@ -541,17 +541,24 @@ _anim_clouds(void *data)
 
    if (bolt)
      {
-        ++bolt;
-        srand(t);
-        evas_object_move(anim->bolt, rand() % ww, -(rand() % (wh / 2)));
-        evas_object_show(anim->bolt);
-     }
-
-   if (bolt && (bolt % 2)) evas_object_hide(anim->bolt);
-   if (bolt > 20)
-     {
-        evas_object_hide(anim->bolt);
-        bolt = 0;
+        struct timespec ts;
+        clock_gettime(CLOCK_REALTIME, &ts);
+        srand(ts.tv_nsec);
+        if (bolt++ == 1)
+          {
+             evas_object_image_size_get(anim->bolt, &iw, &ih);
+             evas_object_move(anim->bolt, -(rand() % iw), -(rand() % (ih / 
4)));
+          }
+
+        if (bolt > 20)
+          {
+             evas_object_hide(anim->bolt);
+             bolt = 0;
+          }
+        else if (!(bolt % 2))
+          evas_object_show(anim->bolt);
+        else
+          evas_object_hide(anim->bolt);
      }
 
    if (anim->pos >= iw)

-- 


Reply via email to