I checked manim's method. I tried using VectorField.

```
from manimlib.imports import *
def pendulum_vector_field_func(point, mu = 0.1, g = 9.8, L = 3):
theta, omega = point[:2]
return np.array([omega, -np.sqrt(g / L) * np.sin(theta) - mu * omega, 0, ])
class test(Scene):
def construct(self):
plane = NumberPlane()
mu_tracker = ValueTracker(1)
field = VectorField(lambda p: pendulum_vector_field_func(plane.point_to_coords(p), mu = mu_tracker.get_value()), delta_x = 0.5, delta_y = 0.5, max_magnitude = 6, opacity = 0.5, )
field.set_opacity(1)
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, animated_stream_lines)
self.wait(10)
```

https://www.youtube.com/watch?v=rkXmemK4cuA

that's all.

Recommended Posts