https://discord.com/channels/581738731934056449/1178561529914871818/1180619063161016390

from manim import * | |
# https://discord.com/channels/581738731934056449/1178561529914871818/1180619063161016390 | |
class feynman(Scene): | |
def construct(self): | |
MyTexTemplate = TexTemplate() | |
MyTexTemplate.add_to_preamble(r"\usepackage{tikz}\usepackage[compat=1.1.0]{tikz-feynman}") | |
feyn = Tex(r""" | |
\begin{tikzpicture} | |
\begin{feynman} | |
\vertex (a) {\(\mu^{-}\)}; | |
\vertex [right=of a] (b); | |
\vertex [above right=of b] (f1) {\(\nu_{\mu}\)}; | |
\vertex [below right=of b] (c); | |
\vertex [above right=of c] (f2) {\(\overline \nu_{e}\)}; | |
\vertex [below right=of c] (f3) {\(e^{-}\)}; | |
\diagram* { | |
(a) -- [fermion] (b) -- [fermion] (f1), | |
(b) -- [boson, edge label'=\(W^{-}\)] (c), | |
(c) -- [anti fermion] (f2), | |
(c) -- [fermion] (f3), | |
}; | |
\end{feynman} | |
\end{tikzpicture} | |
""", | |
tex_template=MyTexTemplate, | |
).set_stroke(width=3) | |
# uncomment the following lines for the indices | |
#self.add(feyn) | |
#self.add(index_labels(feyn[0]).set_color(RED)) | |
self.play( | |
Write(feyn[0][0:2]), | |
Write(feyn[0][4:7]) | |
) | |
feyn[0][16].reverse_points() | |
self.play( | |
Create(feyn[0][9:11]), | |
Create(feyn[0][16:18]) | |
) | |
self.play( | |
Create(feyn[0][13]), | |
Write(feyn[0][14:16]) | |
) | |
self.play( | |
Create(feyn[0][11:13]), | |
Create(feyn[0][18:20]), | |
Write(feyn[0][2:4]), | |
Write(feyn[0][7:9]) | |
) | |
self.wait() |