Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Make sure smooth returns values only between 0 and 1

Grant Sanderson67ae6bf3a829
diff --git a/manimlib/utils/rate_functions.py b/manimlib/utils/rate_functions.py
index a5646f307..fbbe7f5eb 100644
--- a/manimlib/utils/rate_functions.py
+++ b/manimlib/utils/rate_functions.py
@@ -10,7 +10,10 @@ def linear(t):
def smooth(t, inflection=10.0):
error = sigmoid(-inflection / 2)
- return (sigmoid(inflection * (t - 0.5)) - error) / (1 - 2 * error)
+ return np.clip(
+ (sigmoid(inflection * (t - 0.5)) - error) / (1 - 2 * error),
+ 0, 1,
+ )
def rush_into(t):