【问题标题】:Manim reverse = True only works for textManim reverse = True 仅适用于文本
【发布时间】:2022-01-02 20:42:53
【问题描述】:

我正在使用 manim 并尝试反转线条的动画(从右到左而不是从左到右淡入)。我将文档的这一部分用作模型:https://docs.manim.community/en/stable/reference/manim.animation.creation.Write.html?highlight=Write。 正如文档显示的那样,它适用于文本,但是对于线条(我猜更普遍地适用于 Mobjects),它不起作用,这里有一些代码可以证明这一点:

from manim import *
class test(Scene):
    def construct(self):
        l = Line(np.array([-1, 1, 0]), np.array([1, 1, 0]), stroke_width=0.5)
        self.play(Write(l, reverse = True))
        l = Line(np.array([-1, 0, 0]), np.array([1, 0, 0]), stroke_width=0.5)
        self.play(Write(l, reverse = False))

知道为什么 reverse = True 被破坏了吗?

谢谢!!

【问题讨论】:

    标签: python animation manim


    【解决方案1】:

    我应该补充一点,我通过执行以下操作找到了解决方法:

    from manim import *
    class testbis(Scene):
        def construct(self):
            l = Line(np.array([1, 1, 0]), np.array([-1, 1, 0]), stroke_width=0.5)
            self.play(Write(l))
    

    它会做我想做的,但我需要反转 Line 的 startend 参数。这很奇怪,因为这就是 reverse = True 应该做的。

    【讨论】:

      猜你喜欢
      • 2011-10-13
      • 1970-01-01
      • 2023-02-10
      • 2022-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-07
      相关资源
      最近更新 更多