Merge branch 'master' into lighthouse

This commit is contained in:
Ben Hambrecht 2018-01-22 11:55:19 -08:00
commit ad6a05074b
3 changed files with 20 additions and 5 deletions

View file

@ -79,6 +79,12 @@ TEX_IMAGE_DIR = TEX_DIR #TODO, What is this doing?
MOBJECT_DIR = os.path.join(FILE_DIR, "mobjects") MOBJECT_DIR = os.path.join(FILE_DIR, "mobjects")
IMAGE_MOBJECT_DIR = os.path.join(MOBJECT_DIR, "image") IMAGE_MOBJECT_DIR = os.path.join(MOBJECT_DIR, "image")
if not os.path.exists(MEDIA_DIR):
raise Exception("""
Redefine MEDIA_DIR in constants.py to point to
a valid directory where movies and images will
be written
""")
for folder in [FILE_DIR, RASTER_IMAGE_DIR, SVG_IMAGE_DIR, ANIMATIONS_DIR, TEX_DIR, for folder in [FILE_DIR, RASTER_IMAGE_DIR, SVG_IMAGE_DIR, ANIMATIONS_DIR, TEX_DIR,
TEX_IMAGE_DIR, MOBJECT_DIR, IMAGE_MOBJECT_DIR, TEX_IMAGE_DIR, MOBJECT_DIR, IMAGE_MOBJECT_DIR,
STAGED_SCENES_DIR]: STAGED_SCENES_DIR]:

View file

@ -87,7 +87,7 @@ class TexMobject(SVGMobject):
should_replace = reduce(op.and_, [ should_replace = reduce(op.and_, [
t1 in tex, t1 in tex,
t2 not in tex, t2 not in tex,
len(tex) > len(t1) and tex[len(t1)] in "()[]|\\" len(tex) > len(t1) and tex[len(t1)] in "()[]<>|.\\"
]) ])
if should_replace: if should_replace:
tex = tex.replace(t1, "\\big") tex = tex.replace(t1, "\\big")
@ -166,9 +166,16 @@ class TexMobject(SVGMobject):
part.highlight(color) part.highlight(color)
return self return self
def highlight_by_tex_to_color_map(self, tex_to_color_map): def highlight_by_tex_to_color_map(self, texs_to_color_map, **kwargs):
for tex, color in tex_to_color_map.items(): for texs, color in texs_to_color_map.items():
self.highlight_by_tex(tex, color) try:
# If the given key behaves like strings
texs + ''
self.highlight_by_tex(texs, color, **kwargs)
except TypeError:
# If the given key is a tuple
for tex in texs:
self.highlight_by_tex(tex, color, **kwargs)
return self return self
def index_of_part(self, part): def index_of_part(self, part):

View file

@ -493,6 +493,8 @@ class Broadcast(LaggedStart):
"small_radius" : 0.0, "small_radius" : 0.0,
"big_radius" : 5, "big_radius" : 5,
"n_circles" : 5, "n_circles" : 5,
"start_stroke_width" : 8,
"color" : WHITE,
"remover" : True, "remover" : True,
"lag_ratio" : 0.7, "lag_ratio" : 0.7,
"run_time" : 3, "run_time" : 3,
@ -510,7 +512,7 @@ class Broadcast(LaggedStart):
circle.move_to(focal_point) circle.move_to(focal_point)
circle.save_state() circle.save_state()
circle.scale_to_fit_width(self.small_radius*2) circle.scale_to_fit_width(self.small_radius*2)
circle.set_stroke(WHITE, 8) circle.set_stroke(self.color, self.start_stroke_width)
circles.add(circle) circles.add(circle)
LaggedStart.__init__( LaggedStart.__init__(
self, ApplyMethod, circles, self, ApplyMethod, circles,