A community-maintained Python framework for creating mathematical animations.
StreamLine test
Grant Sanderson1c868906b9ad
diff --git a/active_projects/ode/part1/staging.py b/active_projects/ode/part1/staging.pyindex ae8c158bf..178a3469c 100644--- a/active_projects/ode/part1/staging.py+++ b/active_projects/ode/part1/staging.py@@ -2,7 +2,7 @@ from big_ol_pile_of_manim_imports import *def pendulum_vector_field(point, mu=0.1, g=9.8, L=3):- theta, omega, z = point+ theta, omega = point[:2]return np.array([omega,-np.sqrt(g / L) * np.sin(theta) - mu * omega,@@ -10,18 +10,39 @@ def pendulum_vector_field(point, mu=0.1, g=9.8, L=3):])+# Scenes+class VectorFieldTest(Scene):def construct(self):plane = NumberPlane(# axis_config={"unit_size": 2})+ mu_tracker = ValueTracker(1)field = VectorField(lambda p: pendulum_vector_field(- [*plane.point_to_coords(p), 0],- mu=0.1+ plane.point_to_coords(p),+ mu=mu_tracker.get_value()),+ delta_x=0.5,+ delta_y=0.5,max_magnitude=4,+ opacity=0.5,# length_func=lambda norm: norm,)+ stream_lines = StreamLines(+ field.func,+ delta_x=0.5,+ delta_y=0.5,+ )+ animated_stream_lines = AnimatedStreamLines(+ stream_lines,+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth,+ )- self.add(plane, field)+ self.add(plane, field, animated_stream_lines)+ self.wait(10)+++class NewSceneName(Scene):+ def construct(self):+ pass