我对 manim 还很陌生
我希望能够绘制折线图,并在绘制线之后,围绕其截距旋转它。但是现在,转换没有发生:我的代码只显示了相同的 graph0 不变线,并且没有执行 ReplacementTransform。
我也尝试过枢轴,它有效,但是将线绕其中心枢转,即使我可以让它绕其截距枢转,我也不知道如何将其精确到我想要的每个枢轴的等式。
有没有办法让这条线转向我用 graph0、graph1 和 graph2 指定的不同方程?
这是我的代码
class LinePivot(GraphScene):
CONFIG = {
"y_max": 40,
"y_min": 0,
"x_max": 14,
"x_min": 0,
"y_tick_frequency": 5,
"x_tick_frequency": 1,
"axes_color": BLACK,
"y_label_direction": LEFT,
"x_label_direction": DOWN,
"label_nums_color": BLACK,
"camera_config": {
"background_color": WHITE,
},
}
def construct(self):
self.setup_axes()
graph0 = self.get_graph(lambda x: 5 + 2 * x, color=BLACK)
graph1 = self.get_graph(lambda x: 5 + 3 * x, color=BLACK)
graph2 = self.get_graph(lambda x: 5 + 4 * x, color=BLACK)
self.play(ShowCreation(graph0))
self.wait()
ReplacementTransform(graph0, graph1, run_time=1)
self.wait()
ReplacementTransform(graph1, graph2, run_time=1)
self.wait()
答案 0 :(得分:2)
ReplacementTransform(graph0, graph1, run_time=1)
仅创建转换,但不将其添加到场景或渲染它。你想改用
self.play(ReplacementTransform(graph0, graph1), run_time=1)