mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
commit
ba2f2f8840
9 changed files with 2239 additions and 10 deletions
2193
3b1b_projects/active/bayes.py
Normal file
2193
3b1b_projects/active/bayes.py
Normal file
File diff suppressed because it is too large
Load diff
2
LICENSE
2
LICENSE
|
@ -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:
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
21
manimlib/utils/debug.py
Normal 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
|
Loading…
Add table
Reference in a new issue