From 8b1ce4e0ec114d83b2ee5bba5b3107a936a5584d Mon Sep 17 00:00:00 2001 From: niko Date: Mon, 3 Jan 2022 06:42:51 -0500 Subject: [PATCH] added step easing (#678) * added snap easing * moved step function to the bottom of the list Co-authored-by: Robert --- src/Artemis.Core/Utilities/Easings.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Core/Utilities/Easings.cs b/src/Artemis.Core/Utilities/Easings.cs index 3bffa45ed..5bcc4cb90 100644 --- a/src/Artemis.Core/Utilities/Easings.cs +++ b/src/Artemis.Core/Utilities/Easings.cs @@ -54,6 +54,7 @@ namespace Artemis.Core case Functions.BounceEaseIn: return BounceEaseIn(p); case Functions.BounceEaseOut: return BounceEaseOut(p); case Functions.BounceEaseInOut: return BounceEaseInOut(p); + case Functions.Step: return Step (p); } } @@ -358,6 +359,13 @@ namespace Artemis.Core return 0.5 * BounceEaseOut(p * 2 - 1) + 0.5; } + /// + /// An snappy animation that moves instantly to the next destination on the next keyframe + /// + public static double Step (double p) { + return Math.Floor (p); + } + /// /// Easing Functions enumeration /// @@ -393,7 +401,8 @@ namespace Artemis.Core BackEaseInOut, BounceEaseIn, BounceEaseOut, - BounceEaseInOut + BounceEaseInOut, + Step } } } \ No newline at end of file