mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Introduced BulletedList
This commit is contained in:
parent
134aad7609
commit
67cc62a623
1 changed files with 37 additions and 1 deletions
|
@ -26,7 +26,6 @@ class TexSymbol(VMobjectFromSVGPathstring):
|
||||||
self.set_stroke(width = added_width + mobject.get_stroke_width())
|
self.set_stroke(width = added_width + mobject.get_stroke_width())
|
||||||
self.set_fill(opacity = opacity)
|
self.set_fill(opacity = opacity)
|
||||||
|
|
||||||
|
|
||||||
class TexMobject(SVGMobject):
|
class TexMobject(SVGMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"template_tex_file" : TEMPLATE_TEX_FILE,
|
"template_tex_file" : TEMPLATE_TEX_FILE,
|
||||||
|
@ -264,6 +263,43 @@ class Brace(TexMobject):
|
||||||
vect = self.get_tip() - self.get_center()
|
vect = self.get_tip() - self.get_center()
|
||||||
return vect/np.linalg.norm(vect)
|
return vect/np.linalg.norm(vect)
|
||||||
|
|
||||||
|
class BulletedList(TextMobject):
|
||||||
|
CONFIG = {
|
||||||
|
"buff" : MED_LARGE_BUFF,
|
||||||
|
"dot_scale_factor" : 2,
|
||||||
|
#Have to include because of handle_multiple_args implementation
|
||||||
|
"template_tex_file" : TEMPLATE_TEXT_FILE,
|
||||||
|
"alignment" : "",
|
||||||
|
}
|
||||||
|
def __init__(self, *items, **kwargs):
|
||||||
|
line_separated_items = [s + "\\\\" for s in items]
|
||||||
|
TextMobject.__init__(self, *line_separated_items, **kwargs)
|
||||||
|
for part in self:
|
||||||
|
dot = TexMobject("\\cdot").scale(self.dot_scale_factor)
|
||||||
|
dot.next_to(part[0], LEFT, SMALL_BUFF)
|
||||||
|
part.add_to_back(dot)
|
||||||
|
self.arrange_submobjects(
|
||||||
|
DOWN,
|
||||||
|
aligned_edge = LEFT,
|
||||||
|
buff = self.buff
|
||||||
|
)
|
||||||
|
|
||||||
|
def fade_all_but(self, index_or_string, opacity = 0.5):
|
||||||
|
arg = index_or_string
|
||||||
|
if isinstance(arg, str):
|
||||||
|
part = self.get_part_by_tex(arg)
|
||||||
|
elif isinstance(arg, int):
|
||||||
|
part = self.submobjects[arg]
|
||||||
|
else:
|
||||||
|
raise Exception("Expected int or string, got {0}".format(arg))
|
||||||
|
for other_part in self.submobjects:
|
||||||
|
if other_part is part:
|
||||||
|
other_part.set_fill(opacity = 1)
|
||||||
|
else:
|
||||||
|
other_part.set_fill(opacity = opacity)
|
||||||
|
|
||||||
|
##########
|
||||||
|
|
||||||
def tex_hash(expression, template_tex_file):
|
def tex_hash(expression, template_tex_file):
|
||||||
return str(hash(expression + template_tex_file))
|
return str(hash(expression + template_tex_file))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue