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

69 lines
1.7 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.

from manim import *
import manim
class ManimLogo(Scene):
def construct(self):
# 配置背景色
self.camera.background_color = "#ece6e2"
# 定义品牌色
colors = {
"green": "#87c2a5",
"blue": "#525893",
"red": "#e07a5f",
"black": "#343434"
}
# 创建图形元素
circle = Circle(
color=colors["green"],
fill_opacity=1
).shift(LEFT)
square = Square(
color=colors["blue"],
fill_opacity=1
).shift(UP)
triangle = Triangle(
color=colors["red"],
fill_opacity=1
).shift(RIGHT)
# 创建M符号使用Latex渲染
logo_m = MathTex(
r"\mathbb{M}",
color=colors["black"]
).scale(7).shift(2.25 * LEFT + 1.5 * UP)
# 组合元素(调整层叠顺序)
logo = VGroup(triangle, square, circle, logo_m)
logo.move_to(ORIGIN)
# 优化动画序列
self.play(
LaggedStart(
DrawBorderThenFill(circle),
DrawBorderThenFill(square),
DrawBorderThenFill(triangle),
lag_ratio=0.3
),
run_time=2
)
self.play(Write(logo_m), run_time=1.5)
self.wait(1)
if __name__ == '__main__':
config = {
"quality": "medium_quality",
"preview": True,
"media_dir": "./logo_output",
"pixel_height": 1080,
"pixel_width": 1920
}
with manim.tempconfig(config):
scene = ManimLogo()
scene.render()