69 lines
1.7 KiB
Python
69 lines
1.7 KiB
Python
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() |