- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法使用 manim
显示 latex 表并为其设置动画?
例如
\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}
您在manim
会怎样?
from manimlib import *
import numpy as np
class TableManim(Scene):
def construct(self):
...
最佳答案
如果你想直接用 LaTeX 来完成它,就像这样:
class Table1(Scene):
def construct(self):
table = r"""
\begin{table}[]
\centering
\begin{tabular}{|l|l|l|l|l|}\hline
& & \multicolumn{2}{l}{End} & \\\hline
Top & & Bottom & Bottom & \\
& Top & 40 & 160 & 200 \\
& Bottom & 640 & 160 & 800 \\
& & 200 & 800 & 1000 \\\hline
\end{tabular}
\end{table}
"""
tex_table = TexText(table)
self.play(Write(tex_table))
但是,如果你想用 Manim 制作一个表格,那就有点复杂了,就像这样(如果需要,你可以转换为函数)
class Table2(Scene):
def construct(self):
table = VGroup(*[
VGroup(*[
Text(f"{t}")
for t in row
]).arrange(DOWN,aligned_edge=LEFT)
for row in [
["Top"],
["Top","Bottom"],
["Bottom",40,640,200],
["Bottom",160,160,800],
[200,800,1000],
]],
)
table.scale(0.8)
BUFF = 0.5
rectangles = VGroup(*[
Rectangle(
width=mob.get_width()+BUFF,
height=max(*[t.get_height() for t in table])+BUFF,
).move_to(mob)
for mob in table
])
for t,r,align_direction in zip(table, rectangles, [UP,None,None,None,DOWN]):
if align_direction is not None:
t.align_to(r,align_direction)
t.shift(-align_direction*BUFF/2)
table_group = VGroup(*[
VGroup(t,r)
for t,r in zip(table,rectangles)
])
table_group.arrange(RIGHT,buff=0)
self.add(table_group)
关于python - Manim 展示 latex table ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66534030/
我发现当文本超过 20 行时,此动画需要花费大量时间来渲染。我可以做些什么来加快速度吗? import itertools as it class FormulaExample(Scene): d
请您向我解释一下什么是 VGroup 以及它有什么用处?我试图寻找它,但显然无济于事,没有太多的文档。提前致谢。 最佳答案 基本上是一组VMobjects .所以说你有一些方程由多个单独的 Texmo
你能画对角线/箭头/任何看起来像你在manim数学方程中抵消的东西吗? 最佳答案 最接近的定义是 Cross ,但这并不完全是您要找的,我喜欢用这个: class Cancel(VGroup):
希望你们一切都好! 我想知道如何在 manim 中缩小文本。 我知道你可以做 text.scale(0.8),但我想知道使用后如何做。 例如, text.scale(0.8) self.play(Wr
希望你们一切都好! 我想知道如何在 manim 中缩小文本。 我知道你可以做 text.scale(0.8),但我想知道使用后如何做。 例如, text.scale(0.8) self.play(Wr
ORIGIN 中有一个正方形位置,我想将它移动到 UP*3 并使用以下代码片段同时缩放到 0.5: sq = Square() self.add(sq) self.play(ApplyMethod(s
我在 Manim Community v0.16.0.post0 中有以下文本: dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", colo
有什么办法可以增加动画中特定线条的宽度? 我试图改变DEFAULT_STROKE_WIDTH在 constants.py并设置 stroke_width在 CONFIG等于某个数字,但它不起作用。 这
txt11 = TexMobject(r"-7", color=BLACK) txt12 = TexMobject(r"\frac{1}{7}", color=BLACK).next_to(txt11
txt11 = TexMobject(r"-7", color=BLACK) txt12 = TexMobject(r"\frac{1}{7}", color=BLACK).next_to(txt11
我想用不同颜色绘制 MathTex 元素的变量,但 Manim 似乎对复杂的 Latex 表达式有问题。 这是我的场景。 from manim import * config.frame_width
this is the thing I wanted to make 我是 manim 的新手,我正在尝试将文本放在一个矩形内,如图中所示我怎样才能做到这一点 ?? :( 最佳答案 您可以使用 VGr
我主要尝试运行两个动画(引用以下代码): class RelTrain(Scene): def construct(self): train = Rectangle(heigh
无论如何,我正在尝试(这实际上是我的第一个 manim 程序)。 from manim import * import copy import numpy as np import random co
我开始学习 manim,希望你能帮助我理解这段代码是如何工作的 class Line_1(Scene): def construct(self): path = Line(LE
我是马尼姆新手。 与下面的示例一样, class scene_example(Scene): def construct(self): txt1 = Text("Text1")
我是马尼姆新手。 与下面的示例一样, class scene_example(Scene): def construct(self): txt1 = Text("Text1")
最初的问题发布在 Reddit (https://www.reddit.com/r/manim/comments/lw3xs7/is_it_possible_to_run_manim_programm
有没有办法使用 manim 显示 latex 表并为其设置动画? 例如 \begin{table}[] \centering \begin{tabular}{lllll} & & \multico
如果我有 3 行 manim 文本, l = TextMobject("Line 1") l2 = TextMobject("Line 2") l3 = TextMobject("Line 3")
我是一名优秀的程序员,十分优秀!