Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bayes #829

Merged
merged 11 commits into from
Dec 11, 2019
2,193 changes: 2,193 additions & 0 deletions 3b1b_projects/active/bayes.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
All files of this project under the director "projects" are copyright 3Blue1Brown LLC and used by permission for this project only.
All files of this project under the directory "projects" are copyright 3Blue1Brown LLC and used by permission for this project only.

Any other file of this project is available under the MIT license as follow:

Expand Down
4 changes: 2 additions & 2 deletions manimlib/for_3b1b_videos/pi_creature_animations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from manimlib.animation.animation import Animation
from manimlib.animation.composition import AnimationGroup
from manimlib.animation.fading import FadeOut
from manimlib.animation.creation import ShowCreation
from manimlib.animation.creation import DrawBorderThenFill
from manimlib.animation.creation import Write
from manimlib.animation.transform import ApplyMethod
from manimlib.animation.transform import MoveToTarget
Expand All @@ -28,7 +28,7 @@ class PiCreatureBubbleIntroduction(AnimationGroup):
"target_mode": "speaking",
"bubble_class": SpeechBubble,
"change_mode_kwargs": {},
"bubble_creation_class": ShowCreation,
"bubble_creation_class": DrawBorderThenFill,
"bubble_creation_kwargs": {},
"bubble_kwargs": {},
"content_introduction_class": Write,
Expand Down
3 changes: 3 additions & 0 deletions manimlib/for_3b1b_videos/pi_creature_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ class TeacherStudentsScene(PiCreatureScene):
"student_scale_factor": 0.8,
"seconds_to_blink": 2,
"screen_height": 3,
"camera_config": {
"background_color": DARKER_GREY,
},
}

def setup(self):
Expand Down
1 change: 1 addition & 0 deletions manimlib/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
from manimlib.utils.bezier import *
from manimlib.utils.color import *
from manimlib.utils.config_ops import *
from manimlib.utils.debug import *
from manimlib.utils.images import *
from manimlib.utils.iterables import *
from manimlib.utils.file_ops import *
Expand Down
6 changes: 0 additions & 6 deletions manimlib/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,12 +971,6 @@ def shuffle(self, recursive=False):
submob.shuffle(recursive=True)
random.shuffle(self.submobjects)

def print_family(self, n_tabs=0):
"""For debugging purposes"""
print("\t" * n_tabs, self, id(self))
for submob in self.submobjects:
submob.print_family(n_tabs + 1)

# Just here to keep from breaking old scenes.
def arrange_submobjects(self, *args, **kwargs):
return self.arrange(*args, **kwargs)
Expand Down
11 changes: 11 additions & 0 deletions manimlib/mobject/shape_matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@ def __init__(self, mobject, **kwargs):
)
self.replace(mobject, stretch=True)
self.set_stroke(self.stroke_color, self.stroke_width)


class Underline(Line):
CONFIG = {
"buff": SMALL_BUFF,
}

def __init__(self, mobject, **kwargs):
super().__init__(LEFT, RIGHT)
self.match_width(mobject)
self.next_to(mobject, DOWN, buff=self.buff)
8 changes: 7 additions & 1 deletion manimlib/mobject/svg/tex_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def modify_special_strings(self, tex):
if tex == "":
tex = "\\quad"

# To keep files from starting with a line break
if tex.startswith("\\\\"):
tex = tex.replace("\\\\", "\\quad\\\\")

# Handle imbalanced \left and \right
num_lefts, num_rights = [
len([
Expand Down Expand Up @@ -171,8 +175,10 @@ def break_up_by_substrings(self):
"""
new_submobjects = []
curr_index = 0
config = dict(self.CONFIG)
config["alignment"] = ""
for tex_string in self.tex_strings:
sub_tex_mob = SingleStringTexMobject(tex_string, **self.CONFIG)
sub_tex_mob = SingleStringTexMobject(tex_string, **config)
num_submobs = len(sub_tex_mob.submobjects)
new_index = curr_index + num_submobs
if num_submobs == 0:
Expand Down
21 changes: 21 additions & 0 deletions manimlib/utils/debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from manimlib.constants import BLACK
from manimlib.mobject.numbers import Integer
from manimlib.mobject.types.vectorized_mobject import VGroup


def print_family(mobject, n_tabs=0):
"""For debugging purposes"""
print("\t" * n_tabs, mobject, id(mobject))
for submob in mobject.submobjects:
submob.print_family(n_tabs + 1)


def get_submobject_index_labels(mobject, label_height=0.15):
labels = VGroup()
for n, submob in enumerate(mobject):
label = Integer(n)
label.set_height(label_height)
label.move_to(submob)
label.set_stroke(BLACK, 5, background=True)
labels.add(label)
return labels