MCPcopy
hub / github.com/ManimCommunity/manim / __init__

Method __init__

manim/mobject/logo.py:144–185  ·  view source on GitHub ↗
(self, dark_theme: bool = True)

Source from the content-addressed store, hash-verified

142 """
143
144 def __init__(self, dark_theme: bool = True):
145 super().__init__()
146
147 logo_green = "#81b29a"
148 logo_blue = "#454866"
149 logo_red = "#e07a5f"
150 m_height_over_anim_height = 0.75748
151
152 self.font_color = "#ece6e2" if dark_theme else "#343434"
153 self.scale_factor = 1.0
154
155 self.M = VMobjectFromSVGPath(MANIM_SVG_PATHS[0]).flip(cst.RIGHT).center()
156 self.M.set(stroke_width=0).scale(
157 7 * cst.DEFAULT_FONT_SIZE * cst.SCALE_FACTOR_PER_FONT_POINT
158 )
159 self.M.set_fill(color=self.font_color, opacity=1).shift(
160 2.25 * cst.LEFT + 1.5 * cst.UP
161 )
162
163 self.circle = Circle(color=logo_green, fill_opacity=1).shift(cst.LEFT)
164 self.square = Square(color=logo_blue, fill_opacity=1).shift(cst.UP)
165 self.triangle = Triangle(color=logo_red, fill_opacity=1).shift(cst.RIGHT)
166 self.shapes = VGroup(self.triangle, self.square, self.circle)
167 self.add(self.shapes, self.M)
168 self.move_to(cst.ORIGIN)
169
170 anim = VGroup()
171 for ind, path in enumerate(MANIM_SVG_PATHS[1:]):
172 tex = VMobjectFromSVGPath(path).flip(cst.RIGHT).center()
173 tex.set(stroke_width=0).scale(
174 cst.DEFAULT_FONT_SIZE * cst.SCALE_FACTOR_PER_FONT_POINT
175 )
176 if ind > 0:
177 tex.next_to(anim, buff=0.01)
178 tex.align_to(self.M, cst.DOWN)
179 anim.add(tex)
180 anim.set_fill(color=self.font_color, opacity=1)
181 anim.height = m_height_over_anim_height * self.M.height
182
183 # Note: "anim" is only shown in the expanded state
184 # and thus not yet added to the submobjects of self.
185 self.anim = anim
186
187 def scale(self, scale_factor: float, **kwargs: Any) -> ManimBanner:
188 """Scale the banner by the specified scale factor.

Callers

nothing calls this directly

Calls 15

addMethod · 0.95
CircleClass · 0.90
SquareClass · 0.90
TriangleClass · 0.90
VMobjectFromSVGPathClass · 0.85
VGroupClass · 0.85
centerMethod · 0.45
flipMethod · 0.45
scaleMethod · 0.45
setMethod · 0.45
shiftMethod · 0.45
set_fillMethod · 0.45

Tested by

no test coverage detected