Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Change default lag_ratio to something very small

Grant Sanderson776f2707a5a9
diff --git a/manimlib/animation/animation.py b/manimlib/animation/animation.py
index 1052937cb..25840b02d 100644
--- a/manimlib/animation/animation.py
+++ b/manimlib/animation/animation.py
@@ -2,12 +2,15 @@ from copy import deepcopy
import numpy as np
-from manimlib.constants import DEFAULT_ANIMATION_RUN_TIME
from manimlib.mobject.mobject import Mobject
from manimlib.utils.config_ops import digest_config
from manimlib.utils.rate_functions import smooth
+DEFAULT_ANIMATION_RUN_TIME = 1.0
+DEFAULT_ANIMATION_LAG_RATIO = 0.005
+
+
class Animation(object):
CONFIG = {
"run_time": DEFAULT_ANIMATION_RUN_TIME,
@@ -20,7 +23,7 @@ class Animation(object):
# If 1, it is applied to each successively.
# If 0 < lag_ratio < 1, its applied to each
# with lagged start times
- "lag_ratio": 0,
+ "lag_ratio": DEFAULT_ANIMATION_LAG_RATIO,
"suspend_mobject_updating": True,
}
@@ -132,10 +135,7 @@ class Animation(object):
full_length = (num_submobjects - 1) * lag_ratio + 1
value = alpha * full_length
lower = index * lag_ratio
- return np.clip(
- (value - lower),
- 0, 1,
- )
+ return np.clip((value - lower), 0, 1)
# Getters and setters
def set_run_time(self, run_time):
diff --git a/manimlib/constants.py b/manimlib/constants.py
index 20fae7fd1..85fcbb850 100644
--- a/manimlib/constants.py
+++ b/manimlib/constants.py
@@ -131,7 +131,6 @@ DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = MED_SMALL_BUFF
# All in seconds
-DEFAULT_ANIMATION_RUN_TIME = 1.0
DEFAULT_POINTWISE_FUNCTION_RUN_TIME = 3.0
DEFAULT_WAIT_TIME = 1.0