Repository: ManimCommunity/manim
File: manim/mobject/vector_field.py (Python)

Code before:
                    colors,
                )
        for point in start_points:
            points = [point]
            for _ in range(max_steps):
                last_point = points[-1]
                new_point = last_point + dt * func(last_point)
                if outside_box(new_point):
                    break
                points.append(new_point)
            step = max_steps
            if not step:
                continue
            line = Line()
            line.duration = step * dt
            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)
            else:
                if config["renderer"] == "opengl":
                    # scaled for compatibility with cairo
                    line.set_stroke(width=self.stroke_width / 4.0)
                    norms = [
                        self.get_norm(self.func(point)) for point in line.get_points()
                    ]
                    line.set_rgba_array_direct(self.values_to_rgbas(norms, opacity))
                else:
                    line.color_using_background_image(self.background_img)
                    line.set_stroke(width=self.stroke_width, opacity=opacity)
            self.add(line)
        self.stream_lines = [*self.submobjects]

    def get_norm(self, vect):
        return sum(x ** 2 for x in vect) ** 0.5

    def create(
        self,
        lag_ratio: Optional[float] = None,
        run_time: Optional[Callable[[float], float]] = None,
        **kwargs
    ) -> AnimationGroup:
        """The creation animation of the stream lines.

        The stream lines appear in random order.

        Parameters
        ----------
        lag_ratio
            The lag ratio of the animation.
            If undefined, it will be selected so that the total animation length is 1.5 times the run time of each stream line creation.

Review comment (suggestion):

iirc `get_norm` was dropped in favour of numpy's `np.linalg.norm`, so it should be called directly here.

plus, `get_points` was deprecated.

```suggestion
                    norms = np.array([
                        np.linalg.norm(self.func(point)) for point in line.points
                    ])
```



Code after:
        )

        def outside_box(p):
            return (
                p[0] < self.x_min - self.padding
                or p[0] > self.x_max + self.padding
                or p[1] < self.y_min - self.padding
                or p[1] > self.y_max + self.padding
            )

        max_steps = ceil(virtual_time / dt) + 1
        if not self.single_color:
            self.background_img = self.get_colored_background_image()
            if config["renderer"] == "opengl":
                self.values_to_rgbas = self.get_vectorized_rgba_gradient_function(
                    min_color_scheme_value,
                    max_color_scheme_value,
                    colors,
                )
        for point in start_points:
            points = [point]
            for _ in range(max_steps):
                last_point = points[-1]
                new_point = last_point + dt * func(last_point)
                if outside_box(new_point):
                    break
                points.append(new_point)
            step = max_steps
            if not step:
                continue
            if config["renderer"] == "opengl":
                line = OpenGLVMobject()
            else:
                line = VMobject()
            line.duration = step * dt
            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)
            else:
                if config["renderer"] == "opengl":
                    # scaled for compatibility with cairo
                    line.set_stroke(width=self.stroke_width / 4.0)
                    norms = np.array(
                        [np.linalg.norm(self.func(point)) for point in line.points],
                    )
                    line.set_rgba_array_direct(
                        self.values_to_rgbas(norms, opacity),
                        name="stroke_rgba",
                    )
                else: