diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.py index 67bdd5e6a2..44432bbd23 100644 --- a/manim/mobject/vector_field.py +++ b/manim/mobject/vector_field.py @@ -829,7 +829,9 @@ def outside_box(p): step = max(1, int(len(points) / self.max_anchors_per_line)) line.set_points_smoothly(points[::step]) if self.single_color: - line.set_stroke(self.color) + line.set_stroke( + color=self.color, width=self.stroke_width, opacity=opacity + ) else: if config.renderer == RendererType.OPENGL: # scaled for compatibility with cairo diff --git a/tests/module/mobject/types/vectorized_mobject/test_stroke.py b/tests/module/mobject/types/vectorized_mobject/test_stroke.py index 7935caa6da..1110db14b8 100644 --- a/tests/module/mobject/types/vectorized_mobject/test_stroke.py +++ b/tests/module/mobject/types/vectorized_mobject/test_stroke.py @@ -2,6 +2,7 @@ import manim.utils.color as C from manim import VMobject +from manim.mobject.vector_field import StreamLines def test_stroke_props_in_ctor(): @@ -24,3 +25,17 @@ def test_set_background_stroke(): assert m.background_stroke_width == 2 assert m.background_stroke_opacity == 0.8 assert m.background_stroke_color.to_hex() == C.ORANGE.to_hex() + + +def test_streamline_attributes_for_single_color(): + vector_field = StreamLines( + lambda x: x, # It is not important what this function is. + x_range=[-1, 1, 0.1], + y_range=[-1, 1, 0.1], + padding=0.1, + stroke_width=1.0, + opacity=0.2, + color=C.BLUE_D, + ) + assert vector_field[0].stroke_width == 1.0 + assert vector_field[0].stroke_opacity == 0.2