[gnome-shell] util: Add lerp function



commit 07c970d90c768003f35a0d3f1fb9913d5a2b045d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 31 14:18:42 2020 -0300

    util: Add lerp function
    
    We're going to lerp a lot in the future, to it's worthy sharing
    this simple but effective interpolation function.
    
    Add Util.lerp().
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

 js/misc/util.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index 314d7660f6..2da489bbe6 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported findUrls, spawn, spawnCommandLine, spawnApp, trySpawnCommandLine,
             formatTime, formatTimeSpan, createTimeLabel, insertSorted,
-            ensureActorVisibleInScrollView, wiggle */
+            ensureActorVisibleInScrollView, wiggle, lerp */
 
 const { Clutter, Gio, GLib, Shell, St, GnomeDesktop } = imports.gi;
 const Gettext = imports.gettext;
@@ -435,3 +435,7 @@ function wiggle(actor, params) {
         },
     });
 }
+
+function lerp(start, end, progress) {
+    return start + progress * (end - start);
+}


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