57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
|
# -*- coding: utf-8 -*-.py
|
||
|
from manim import *
|
||
|
|
||
|
# 场景类名
|
||
|
class Skeleton_20250804_084303_887(Scene):
|
||
|
def construct(self):
|
||
|
# 创建坐标系
|
||
|
axes = Axes(
|
||
|
x_range=[-3.5 * PI, 3.5 * PI, PI],
|
||
|
y_range=[-1.5, 1.5, 0.5],
|
||
|
axis_config={"color": WHITE},
|
||
|
tips=False,
|
||
|
)
|
||
|
|
||
|
# 添加坐标轴标签
|
||
|
x_label = axes.get_x_axis_label("x")
|
||
|
y_label = axes.get_y_axis_label("y")
|
||
|
|
||
|
# 淡入坐标轴及标签
|
||
|
self.play(
|
||
|
FadeIn(axes),
|
||
|
Write(x_label),
|
||
|
Write(y_label),
|
||
|
run_time=4
|
||
|
)
|
||
|
self.wait(1)
|
||
|
|
||
|
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_084303_887()
|
||
|
# 执行渲染流程(包含文件生成和预览)
|
||
|
scene.render()
|