txt11 = TexMobject(r"-7", color=BLACK)
txt12 = TexMobject(r"\frac{1}{7}", color=BLACK).next_to(txt11, RIGHT)
Run Code Online (Sandbox Code Playgroud)
我想为 txt12 的分母着色,尝试将 txt12 拆分为:
txt12 = TexMobject(r"\frac{1}", r"{7}", color=BLACK).next_to(txt11, RIGHT)
txt12.set_color_by_tex("{7}", BLUE)
Run Code Online (Sandbox Code Playgroud)
但不起作用,然后我创建一个新的 txt13 与 txt12 重叠,但分子为空:
txt13 = TexMobject(r"\frac{}{7}", color=BLUE).move_to(txt12.get_center())
Run Code Online (Sandbox Code Playgroud)
也不行。
有没有可行的方法来给方程的一部分(如分数)着色?谢谢!
我正在尝试安装manim,(请参阅此处:https : //github.com/3b1b/manim)。我正在使用 python 版本 3.7.7。我已经按照这个视频https://www.youtube.com/watch?v=ZltiKHFWmv8的步骤操作,直到我尝试安装 requirements.txt ( https://github.com/3b1b/manim/blob/master/要求.txt)。我在终端上收到此错误:
错误:找不到满足要求 requirements.txt 的版本(来自版本:无)
错误:没有找到 requirements.txt 的匹配分布
有谁知道如何修理它?
如果我有 3 行 manim 文本,
l = TextMobject("Line 1")
l2 = TextMobject("Line 2")
l3 = TextMobject("Line 3")
Run Code Online (Sandbox Code Playgroud)
我想将它们全部制作成动画,我该怎么做?我正在寻找比它更容易输入和更Pythonic的东西
v = np.array([-3, 2, 0]) # Vector to translate the text by
self.play(ApplyMethod(l.shift, v), ApplyMethod(l2.shift, v), ApplyMethod(l3.shift, v))
Run Code Online (Sandbox Code Playgroud)
更像是:
lines = [l, l2, l3]
g = GroupMobjects(*lines)
v = np.array([-3, 2, 0]) # Vector
self.play(ApplyMethod(g.shift, v))
Run Code Online (Sandbox Code Playgroud)
我刚刚GroupMobjects
为上面的例子编写了语法。
我看过 using VGroup
,它似乎与我想要完成的任务很匹配,但问题是我不知道如何使用它,并且 manim 没有最好的文档(尽管对于好理由)。
任何解决方案将不胜感激。
马尼姆社区 v0.15.1
class Equation_Transformation_Bug(Scene):
def construct(self):
equation_1 = MathTex("w", "\\times","v", "=", "1")
equation_1.shift(UP*2).scale(2)
equation_2 = MathTex("v", "=", "w^{-1}")
equation_2.scale(2)
equation_3 = MathTex("w", "\\times","w^{-1}", "=", "1")
equation_3.shift(UP*2).scale(2)
self.play(Write(equation_1), Write(equation_2))
self.wait(2)
self.play(FadeOut(equation_1[2]))
self.play(*[
Transform(
equation_2.get_part_by_tex("w^{-1}"),
equation_3.get_part_by_tex("w^{-1}")
)
] + [
Transform(
equation_1.get_part_by_tex(tex),
equation_3.get_part_by_tex(tex)
)
for tex in ("w", "\\times","=", "1")
])
self.wait(1)
Run Code Online (Sandbox Code Playgroud)
我试图让方程_2 中的 w^{-1} 飞入方程_1 中以前由 v 占据的位置并转换为方程_3。相反,方程_1 中的“1”会转换为方程_3 中的 w^{-1}。我并不是想进行替换变换。
如何将equation_1转换为equation_3并将w^{-1}移动到equation_1的“v”占据的位置?
我希望你们都做得很好!
我想知道如何在 manim 中缩小文本。
我知道你可以做text.scale(0.8)
,但我想知道使用后该怎么做。
例如,
text.scale(0.8)
self.play(Write(text))
makeSmaller(text) <-- what I'm looking for
Run Code Online (Sandbox Code Playgroud)
到目前为止,我已经尝试过ApplyMethod(text.scale(0.8))
但没有成功。
太感谢了
编辑:
理想情况下,我不想创建两个不同的TextMobject
然后在两个动画之间转换。
我是马尼姆的新手。
如下例所示,
class scene_example(Scene):
def construct(self):
txt1 = Text("Text1")
txt2 = Text("Change to this text without animation")
self.play(FadeIn(txt1))
self.play(ReplacementTransform(txt1, txt2))
Run Code Online (Sandbox Code Playgroud)
有什么方便的功能可以将txt1“替换”为txt2吗?(即,没有“变形”动画?)
class scene_example(Scene):
def construct(self):
txt1 = Text("Text1")
txt2 = Text("Change to this text without animation")
self.play(FadeIn(txt1))
self.play(FadeOut(txt1), FadeIn(txt2) )
Run Code Online (Sandbox Code Playgroud)
这段代码将执行我想要的操作,但我觉得可能有像 ReplacemnetTransform 这样的函数来实现简单的“替换”动画。我尝试为 FadeIn 和 FadeOut 创建一个函数,但是这不起作用。
class q(Scene):
def construct(self):
def Replace(self, mObj1, mObj2):
self.play(FadeIn(mObj1),FadeOut(mObj2))
txt1 = "HI"
txt2 = "HI2"
self.play(FadeIn(txt1))
Replace(txt1, txt2)
Run Code Online (Sandbox Code Playgroud) 有没有办法使用显示乳胶表并为其设置动画manim
?
例如
\begin{table}[]
\centering
\begin{tabular}{lllll}
& & \multicolumn{2}{l}{End} & \\
Top & & Bottom & Bottom & \\
& Top & 40 & 160 & 200 \\
& Bottom & 640 & 160 & 800 \\
& & 200 & 800 & 1000
\end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)
你会怎样去manim
?
from manimlib import *
import numpy as np
class TableManim(Scene):
def construct(self):
...
Run Code Online (Sandbox Code Playgroud) 我在 Manim Community v0.16.0.post0 中有以下文本:
dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", color=BLACK)
self.play(Write(dioscuri))
Run Code Online (Sandbox Code Playgroud)
我希望使用 Write 方法写入文本,例如,在左上角而不是默认情况下在场景的中心。换句话说,如何在特定位置启动文字书写动画?
我正在尝试使用 SVG 文件创建一个数字生物。但是当我运行动画并且生物出现时,有一些缺失的部分,我不明白为什么。即使我只是尝试在 SVGM 对象上加载 SVG 文件,它也无法正常工作。
Creature() 是一个子类,它继承了 NumberCreature 类的功能,只是重命名为 Alex()。
这是Python代码:
class NumberCreature(Scene):
def construct(self):
creature = Creature()
self.add(creature)
self.wait()
Run Code Online (Sandbox Code Playgroud)
这是原始的 SVG 代码: https: //codeshare.io/aYM4Mn 这是预期的结果: SVG 原始图像
当我运行 python 代码时,这是真正的结果:SVG generated image by manim
我还尝试运行这个Python代码:
class NumberCreature(Scene):
def construct(self):
creature = SVGMobject('/home/usr/manim/assets/svg_images/NumberCreature_plain.svg')
self.add(creature)
self.wait()
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,图像的某些部分丢失了,即使我尝试使用creature[index].set_color(original_hex_color)正确地为所有内容着色,结果始终与原始结果不同。
请帮助我,我不知道到底发生了什么,我对 manim 还很菜鸟。
我有一个可变随机长度的点列表,我希望能够独立但同时对这些对象应用变换(在本例中为移位)。
list = [Dot(), Dot() ...] # Variable length
Run Code Online (Sandbox Code Playgroud)
我正在使用 3blue1brown 的https://github.com/3b1b/manim的 Manim 库。请注意,其他相关帖子无法解决我的问题,因为它们仅适用于固定数量的对象(点)。