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

Manim社区版ParametricFunction动画时长设置报错解决方案咨询

解决Manim社区版ParametricFunction绘制动画时长设置问题
  • 错误原因:func.animate接口仅用于修改已有Mobject的属性(如位置、缩放、颜色),并不适用于触发ParametricFunction的创建绘制动画,强行使用会导致线程锁对象无法序列化的错误。
  • 正确实现方式:使用Create动画类来绘制函数曲线,将run_time=2传递给Create或直接作为self.play的参数即可。

示例代码:

from manim import *

class PlotParametricFunction(Scene):
    def construct(self):
        func = ParametricFunction(
            lambda t: np.array([
                np.cos(t),
                np.sin(t),
                0
            ]), 
            t_range=np.array([0, 2*PI]), 
            color=RED
        )
        # 方式1:将run_time传入Create动画
        self.play(Create(func, run_time=2))
        # 方式2:将run_time作为self.play的参数,效果一致
        # self.play(Create(func), run_time=2)
        self.wait()

如果需要更平滑的绘制效果,也可以替换Create为Write动画,同样支持run_time参数。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 12:31:00