mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 23:02:14 +03:00
Optimize animation calculation
This commit is contained in:
parent
07f7c21482
commit
097cda8b6b
@ -192,7 +192,11 @@ public class Gala.GestureTracker : Object {
|
|||||||
* @returns The linear animation value at the specified percentage.
|
* @returns The linear animation value at the specified percentage.
|
||||||
*/
|
*/
|
||||||
public static float animation_value (float initial_value, float target_value, double percentage, bool rounded = false) {
|
public static float animation_value (float initial_value, float target_value, double percentage, bool rounded = false) {
|
||||||
float value = ((target_value - initial_value) * (float) percentage) + initial_value;
|
float value = initial_value;
|
||||||
|
|
||||||
|
if (initial_value != target_value) {
|
||||||
|
value = ((target_value - initial_value) * (float) percentage) + initial_value;
|
||||||
|
}
|
||||||
|
|
||||||
if (rounded) {
|
if (rounded) {
|
||||||
value = Math.roundf (value);
|
value = Math.roundf (value);
|
||||||
|
Loading…
Reference in New Issue
Block a user