Merge pull request #829 from 3b1b/bayes

Bayes
This commit is contained in:
Grant Sanderson 2019-12-10 21:47:09 -08:00 committed by GitHub
commit ba2f2f8840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 2239 additions and 10 deletions

File diff suppressed because it is too large Load diff

View file

@ -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:

View file

@ -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
@ -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,

View file

@ -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):

View file

@ -86,6 +86,7 @@ from manimlib.scene.zoomed_scene import *
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 *

View file

@ -971,12 +971,6 @@ class Mobject(Container):
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)

View file

@ -72,3 +72,14 @@ class Cross(VGroup):
)
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)

View file

@ -78,6 +78,10 @@ class SingleStringTexMobject(SVGMobject):
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([
@ -171,8 +175,10 @@ class TexMobject(SingleStringTexMobject):
"""
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:

21
manimlib/utils/debug.py Normal file
View file

@ -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