mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Improvements to TexMobject
This commit is contained in:
parent
505a86b5b8
commit
8e71db4f69
1 changed files with 25 additions and 0 deletions
|
@ -5,6 +5,7 @@ from svg_mobject import VMobjectFromSVGPathstring
|
|||
from utils.config_ops import digest_config
|
||||
from utils.strings import split_string_list_to_isolate_substring
|
||||
from utils.tex_file_writing import tex_to_svg_file
|
||||
from mobject.geometry import Line
|
||||
from mobject.types.vectorized_mobject import VGroup
|
||||
from mobject.types.vectorized_mobject import VectorizedPoint
|
||||
|
||||
|
@ -290,3 +291,27 @@ class TexMobjectFromPresetString(TexMobject):
|
|||
TexMobject.__init__(self, self.tex, **kwargs)
|
||||
self.set_color(self.color)
|
||||
|
||||
|
||||
class Title(TextMobject):
|
||||
CONFIG = {
|
||||
"scale_factor": 1,
|
||||
"include_underline": True,
|
||||
"underline_width": FRAME_WIDTH - 2,
|
||||
# This will override underline_width
|
||||
"match_underline_width_to_text": False,
|
||||
"underline_buff": MED_SMALL_BUFF,
|
||||
}
|
||||
|
||||
def __init__(self, text, **kwargs):
|
||||
TextMobject.__init__(self, text, **kwargs)
|
||||
self.scale(self.scale_factor)
|
||||
self.to_edge(UP)
|
||||
if self.include_underline:
|
||||
underline = Line(LEFT, RIGHT)
|
||||
underline.next_to(self, DOWN, buff=self.underline_buff)
|
||||
if self.match_underline_width_to_text:
|
||||
underline.match_width(self)
|
||||
else:
|
||||
underline.scale_to_fit_width(self.underline_width)
|
||||
self.add(underline)
|
||||
self.underline = underline
|
||||
|
|
Loading…
Add table
Reference in a new issue