Skip to content

The issue of inaccurate coloring with set_color(). #4198

Open
@PromiseWang

Description

@PromiseWang

At first, I wanted to draw a line, but I found the color was inaccurate. Later, I drew several lines in different directions, but why does the color still look wrong? Line1 has no color gradient, Line2 and Line3 are fine, but the color of Line4 is reversed.

class ColorTest(Scene):
    def construct(self):
        Line1 = Line(np.array([-1, 0, 0]), np.array([0, 1, 0])).set_color(color=["#7301FF", "#EDCD00"])
        Line2 = Line(np.array([-1, 0, 0]), np.array([1, 0, 0])).set_color(color=["#7301FF", "#EDCD00"])
        Line3 = Line(np.array([-1, 0, 0]), np.array([0, -1, 0])).set_color(color=["#7301FF", "#EDCD00"])
        Line4 = Line(np.array([-1, 0, 0]), np.array([-1, 1, 0])).set_color(color=["#7301FF", "#EDCD00"])
        self.play(Create(Line1), Create(Line2), Create(Line3), Create(Line4))
        self.wait(2)

Image

My idea was to draw a line with the starting point at (-1, 0) and the endpoint at (0, 1), with the color gradient from #EDCD00 to #7301FF. After looking into the issue with set_color_by_gradient(), I found that someone solved it using set_color(), but the color start and end points were reversed.

What should I do?

Manim Community v0.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions