from manim import * import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt config.background_color = "#161616" def tex_png(expr, path, color="white", fs=64, dpi=300): fig = plt.figure(figsize=(0.01, 0.01)); fig.patch.set_alpha(0) fig.text(0, 0, f"${expr}$", color=color, fontsize=fs) fig.savefig(path, dpi=dpi, transparent=True, bbox_inches="tight", pad_inches=0.05) plt.close(fig); return path class Smoke(Scene): def construct(self): title = Text("Gaussian", color="#58C4DD", font_size=44).to_edge(UP) ax = Axes(x_range=[-3, 3], y_range=[-0.2, 1.2], axis_config={"color": GREY}) curve = ax.plot(lambda x: np.exp(-x**2), color="#58C4DD") tex_png(r"e^{-x^2}", "eq.png", color="#FFFF00") eq = ImageMobject("eq.png").scale(0.5).to_corner(UR) self.play(Write(title), run_time=1) self.play(Create(ax), run_time=1) self.play(Create(curve), run_time=1.5) self.play(FadeIn(eq, shift=UP*0.3)) self.wait(0.5)