Files
dsProject/dsLightRag/Manim/L0_HelloWorld.py
2025-08-14 15:45:08 +08:00

31 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import manim
from manim import *
class HelloWorld(Scene):
def construct(self):
text = Text("欢迎来到东师理想数学动画工坊!")
self.play(Write(text))
self.wait()
# 当直接运行本脚本时执行以下代码
if __name__ == '__main__':
"""
配置渲染参数并执行场景渲染
等效命令行命令:
manim -pql -o custom_output 当前文件.py BoxAnimation
"""
# 配置字典说明:
config = {
"quality": "low_quality", # 渲染质量等级low_quality对应480p
"preview": True, # 渲染完成后自动打开播放器
"input_file": __file__, # 指定输入文件为当前文件
"media_dir": "./custom_output" # 自定义输出目录默认在media/
}
# 使用临时配置渲染场景配置只在with块内有效
with manim.tempconfig(config):
# 实例化场景类
scene = HelloWorld()
# 执行渲染流程(包含文件生成和预览)
scene.render()