You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Manim v0.17.2中依次执行两个线性变换动画报错求助

问题解决:Manim线性变换动画报错"All submobjects must be of type VMobject"

错误根源

你的代码中__init__方法调用父类构造函数时,错误地将self作为第一个参数传入super().__init__(),这会导致Manim内部把self当成配置参数处理,进而触发类型错误。

修正后的代码

class LT(LinearTransformationScene):
    def __init__(self):
        super().__init__(
            show_coordinates=True,
            leave_ghost_vectors=True,
        )

    def construct(self):
        A = [[1, 1], [1, -1]]
        self.apply_matrix(A)
        self.wait()

        B = [[2, 0], [0, 0.5]]
        self.apply_matrix(B)
        self.wait()

说明

  • 移除super().__init__()中的self参数后,父类构造函数能正确处理配置项(show_coordinates、leave_ghost_vectors)。
  • 修正后代码会先播放矩阵A的线性变换动画,等待片刻后再播放矩阵B的线性变换动画,符合分步动画的需求,同时保留变换后的幽灵向量。

内容的提问来源于stack exchange,提问作者haifisch123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 03:07:04