summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorTokage <tokage.it.lab@gmail.com>2021-04-25 05:47:03 +0900
committerSilc 'Tokage' Renew <tokage.it.lab@gmail.com>2021-10-09 18:08:43 +0900
commit372ba7666304805abe8641487c97899f9bdd97af (patch)
tree3a5d56b1fd80db923c08fa25c7c3d407b992c496 /core/variant
parente8c89b2b9158ce011ed5c1a913f55d38226c4a55 (diff)
implement ping-pong loop in animation
Co-authored-by: Chaosus <chaosus89@gmail.com>
Diffstat (limited to 'core/variant')
-rw-r--r--core/variant/variant_utility.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 55c1376031..06e201d50a 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -275,6 +275,10 @@ struct VariantUtilityFunctions {
return Math::wrapf(value, min, max);
}
+ static inline double pingpong(double value, double length) {
+ return Math::pingpong(value, length);
+ }
+
static inline Variant max(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
if (p_argcount < 2) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -1226,6 +1230,7 @@ void Variant::_register_variant_utility_functions() {
FUNCBINDR(clampf, sarray("value", "min", "max"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(nearest_po2, sarray("value"), Variant::UTILITY_FUNC_TYPE_MATH);
+ FUNCBINDR(pingpong, sarray("value", "length"), Variant::UTILITY_FUNC_TYPE_MATH);
// Random