CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UIAnimation.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
13
14#include <functional>
15
16namespace CeresEngine {
17
20 template<typename T> class UIAnimationEasing final {
21 public:
22 using FunctionRef = T (*)(double, const T&, const T&) noexcept;
23
24 private:
26
27 public:
29
30 public:
31 [[nodiscard]] T operator()(const double t, const T& a, const T& b) const noexcept { return mFunction(t, a, b); }
32
33 public:
38
41
44
47 };
48
49 template<typename T>
50 inline const UIAnimationEasing<T> UIAnimationEasing<T>::Linear = +[](double t, const T& a, const T& b) noexcept -> T {
51 return lerp(t, a, b);
52 };
53
56 template<typename T> class UIAnimationCurve final {
57 public:
58 using FunctionRef = T (*)(double, const T&, const T&);
59
60 private:
62 double start;
63 double end;
64
65 public:
70
72 static const UIAnimationCurve EaseIn(T start, T end) { return UIAnimationCurve(); }
73
75 static const UIAnimationCurve EaseOut(T start, T end) { return UIAnimationCurve(); }
76
78 static const UIAnimationCurve Linear(T start, T end) { return UIAnimationCurve(); }
79 };
80
81 class UIAnimation {};
82
83} // namespace CeresEngine
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
These constants describe the curve of an animation—that is, the relative speed of an animation from s...
Definition UIAnimation.hpp:56
FunctionRef mFunction
Definition UIAnimation.hpp:61
static const UIAnimationCurve EaseOut(T start, T end)
Describes an animation that slowly speeds up from the start.
Definition UIAnimation.hpp:75
static const UIAnimationCurve EaseIn(T start, T end)
Describes an animation that slows down as it reaches the end.
Definition UIAnimation.hpp:72
T(*)(double, const T &, const T &) FunctionRef
Definition UIAnimation.hpp:58
static UIAnimationCurve EaseInOut(T start, T end)
Describes an S-curve in which the animation slowly speeds up and then slows down near the end of the ...
Definition UIAnimation.hpp:69
double start
Definition UIAnimation.hpp:62
double end
Definition UIAnimation.hpp:63
static const UIAnimationCurve Linear(T start, T end)
Describes an animation in which there is no change in frame rate.
Definition UIAnimation.hpp:78
These constants describe the curve of an animation—that is, the relative speed of an animation from s...
Definition UIAnimation.hpp:20
T(*)(double, const T &, const T &) noexcept FunctionRef
Definition UIAnimation.hpp:22
FunctionRef mFunction
Definition UIAnimation.hpp:25
T operator()(const double t, const T &a, const T &b) const noexcept
Definition UIAnimation.hpp:31
static const UIAnimationEasing EaseOut
Describes an animation that slowly speeds up from the start.
Definition UIAnimation.hpp:43
static const UIAnimationEasing Linear
Describes an animation in which there is no change in frame rate.
Definition UIAnimation.hpp:46
static UIAnimationEasing EaseInOut
Describes an S-curve in which the animation slowly speeds up and then slows down near the end of the ...
Definition UIAnimation.hpp:37
static const UIAnimationEasing EaseIn
Describes an animation that slows down as it reaches the end.
Definition UIAnimation.hpp:40
Definition UIAnimation.hpp:81
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25