Moved easing functions into their own file
This commit is contained in:
parent
8193bb6e4b
commit
dec948dc80
10
include/sway/desktop/fx_renderer/animation_utils.h
Normal file
10
include/sway/desktop/fx_renderer/animation_utils.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef ANIMATION_UTILS_H
|
||||
#define ANIMATION_UTILS_H
|
||||
|
||||
double lerp (double a, double b, double t);
|
||||
|
||||
double ease_out_cubic (double t);
|
||||
|
||||
// TODO: Add more easing functions in the future like ease_in and ease_in_out, etc...
|
||||
|
||||
#endif
|
12
sway/desktop/fx_renderer/animation_utils.c
Normal file
12
sway/desktop/fx_renderer/animation_utils.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <math.h>
|
||||
|
||||
#include "sway/desktop/fx_renderer/animation_utils.h"
|
||||
|
||||
double lerp (double a, double b, double t) {
|
||||
return a * (1.0 - t) + b * t;
|
||||
}
|
||||
|
||||
double ease_out_cubic (double t) {
|
||||
double p = t - 1;
|
||||
return pow(p, 3) + 1;
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/desktop/fx_renderer/animation_utils.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
#include "sway/input/seat.h"
|
||||
|
@ -1108,15 +1109,6 @@ void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
|||
apply_output_config(oc, output);
|
||||
}
|
||||
|
||||
static double lerp (double a, double b, double t) {
|
||||
return a * (1.0 - t) + b * t;
|
||||
}
|
||||
|
||||
static double ease_out_cubic (double t) {
|
||||
double p = t - 1;
|
||||
return pow(p, 3) + 1;
|
||||
}
|
||||
|
||||
struct workspace_scroll workspace_scroll_get_default() {
|
||||
return (struct workspace_scroll) {
|
||||
.percent = 0,
|
||||
|
|
|
@ -20,6 +20,7 @@ sway_sources = files(
|
|||
'desktop/fx_renderer/fx_stencilbuffer.c',
|
||||
'desktop/fx_renderer/fx_texture.c',
|
||||
'desktop/fx_renderer/matrix.c',
|
||||
'desktop/fx_renderer/animation_utils.c',
|
||||
'desktop/idle_inhibit_v1.c',
|
||||
'desktop/layer_shell.c',
|
||||
'desktop/output.c',
|
||||
|
|
Loading…
Reference in a new issue