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

57 lines
1.9 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.

# -*- coding: utf-8 -*-.py
# 文件Skeleton/Skeleton_20250804_084523_720.py
from manim import *
class Skeleton_20250804_084523_720(Scene):
def construct(self):
# 创建坐标系对象
axes = Axes(
x_range=[-3.5 * PI, 3.5 * PI, PI], # x轴范围-3.5π到3.5π
y_range=[-1.5, 1.5, 0.5], # y轴范围-1.5到1.5
axis_config={"color": WHITE}, # 坐标轴颜色
tips=False, # 不显示坐标轴箭头
)
# 添加坐标轴标签
axes_labels = axes.get_axis_labels(
MathTex("x").scale(0.7),
MathTex("y").scale(0.7)
)
# 创建坐标轴组
coordinate_system = VGroup(axes, axes_labels)
# 动画:坐标轴淡入
self.play(FadeIn(coordinate_system, run_time=4))
self.wait(2) # 保持显示
if __name__ == "__main__":
# 导入必要的模块
import sys
import os
from manim import *
# 设置 UTF-8 编码
os.environ['PYTHONIOENCODING'] = 'utf-8'
sys.stdout.reconfigure(encoding='utf-8')
sys.stderr.reconfigure(encoding='utf-8')
# 全局指定 ctex 模板(一次性)
config.tex_template = TexTemplateLibrary.ctex
# 设置输出格式为MP4
config.output_format = "mp4"
# 设置输出目录
config.media_dir = "./output/"
# 使用临时配置渲染场景(配置只在with块内有效)
with tempconfig({
"quality": "high_quality",
"background_color": BLACK,
"preview": True,
"pixel_height": 1080,
"pixel_width": 1920,
"frame_rate": 30
}):
# 实例化场景类
scene = Skeleton_20250804_084523_720()
# 执行渲染流程(包含文件生成和预览)
scene.render()