from manim import *


class Demo(Scene):
    def construct(self):
        tex = MathTex("z", "=", r"\sqrt{", "x", "^2 + ", "y", "^2}")
        tex.set_opacity_by_tex("x", 0.4)
        tex.set_opacity_by_tex("y", 0.4)
        tex.set_opacity_by_tex("z", 0.6)
        tex.set_color_by_tex_to_color_map({"x": BLUE, "y": RED, "z": GREEN})
        self.play(FadeIn(tex), run_time=1.0)
        self.wait(4.6)
