Merge pull request #225 from 3b1b/eop

Eop
This commit is contained in:
Grant Sanderson 2018-05-03 03:51:50 -07:00 committed by GitHub
commit 14ab0767f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1314 additions and 417 deletions

View file

@ -0,0 +1,82 @@
from big_ol_pile_of_manim_imports import *
class Introduction(TeacherStudentsScene):
CONFIG = {
"default_pi_creature_kwargs": {
"color": MAROON_E,
"flip_at_start": True,
},
}
def construct(self):
self.show_series()
self.show_examples()
def show_series(self):
series = VideoSeries(num_videos = 11)
series.to_edge(UP)
this_video = series[0]
this_video.set_color(YELLOW)
this_video.save_state()
this_video.set_fill(opacity = 0)
this_video.center()
this_video.scale_to_fit_height(FRAME_HEIGHT)
self.this_video = this_video
words = TextMobject(
"Welcome to \\\\",
"Essence of Probability"
)
words.set_color_by_tex("Essence of Probability", YELLOW)
self.teacher.change_mode("happy")
self.play(
FadeIn(
series,
submobject_mode = "lagged_start",
run_time = 2
),
Blink(self.get_teacher())
)
self.teacher_says(words, target_mode = "hooray")
self.change_student_modes(
*["hooray"]*3,
look_at_arg = series[1].get_left(),
added_anims = [
ApplyMethod(this_video.restore, run_time = 3),
]
)
self.play(*[
ApplyMethod(
video.shift, 0.5*video.get_height()*DOWN,
run_time = 3,
rate_func = squish_rate_func(
there_and_back, alpha, alpha+0.3
)
)
for video, alpha in zip(series, np.linspace(0, 0.7, len(series)))
]+[
Animation(self.teacher.bubble),
Animation(self.teacher.bubble.content),
])
self.play(
FadeOut(self.teacher.bubble),
FadeOut(self.teacher.bubble.content),
self.get_teacher().change_mode, "raise_right_hand",
*[
ApplyMethod(pi.change_mode, "pondering")
for pi in self.get_students()
]
)
self.wait()
self.series = series
def show_examples(self):
self.wait(10)
# put examples here in video editor

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@ class Female(Male):
"color" : MAROON_B,
}
class PascalsTraingle(VGroup):
class PascalsTriangle(VGroup):
CONFIG = {
"n_rows" : 9,
"distance" : 0.8,
@ -143,7 +143,7 @@ class ExperienceProblemSolver(PiCreatureScene):
def think_about_patterns(self):
randy, jenny = self.randy, self.jenny
rows = PascalsTraingle(
rows = PascalsTriangle(
n_rows = 6,
distance = 0.6,
)
@ -1768,7 +1768,7 @@ class IntroducePascalsTriangle(Scene):
self.cap_off_triangle()
def show_triangle(self):
rows = PascalsTraingle(n_rows = self.max_n+1)
rows = PascalsTriangle(n_rows = self.max_n+1)
self.play(FadeIn(rows[1]))
for last_row, curr_row in zip(rows[1:], rows[2:]):
self.play(*[
@ -3477,7 +3477,7 @@ class AskWhyTheyAreCalledBinomial(TeacherStudentsScene):
self.teacher.get_corner(UP+LEFT), UP
)
pascals = PascalsTraingle(n_rows = 6)
pascals = PascalsTriangle(n_rows = 6)
pascals.scale_to_fit_height(3)
pascals.to_corner(UP+LEFT, buff = MED_SMALL_BUFF)
pascals.set_color_by_gradient(BLUE, YELLOW)

View file

@ -107,6 +107,8 @@ class Histogram(VMobject):
self.x_labels = num_arr_to_string_arr(self.widths)
elif self.x_labels == "mids":
self.x_labels = num_arr_to_string_arr(self.x_mids)
elif self.x_labels == "auto":
self.x_labels = num_arr_to_string_arr(self.x_mids)
elif self.x_labels == "none":
self.x_labels = empty_string_array(len(self.widths))
@ -228,7 +230,7 @@ class FlashThroughHistogram(Animation):
self.cell_indices = []
for (i,x) in enumerate(x_values):
nb_cells = y_values[i]
nb_cells = int(np.floor(y_values[i]))
for j in range(nb_cells):
self.cell_indices.append((i, j))
@ -271,8 +273,8 @@ class FlashThroughHistogram(Animation):
self.prototype_cell.generate_points()
self.prototype_cell.move_to(cell.get_center())
#if t == 1:
# self.mobject.remove(self.prototype_cell)
if t == 1:
self.mobject.remove(self.prototype_cell)

View file

@ -32,6 +32,20 @@ def get_quiz(*questions):
quiz.scale(0.7)
return quiz
class Checkmark(TexMobjectFromPresetString):
CONFIG = {
"tex" : "\\checkmark",
"color" : GREEN
}
class Xmark(TexMobjectFromPresetString):
CONFIG = {
"tex" : "\\times",
"color" : RED
}
def get_slot_group(
bool_list,
buff = MED_LARGE_BUFF,

View file

@ -767,7 +767,7 @@ class Mobject(Container):
"""For debugging purposes"""
print "\t" * n_tabs, self, id(self)
for submob in self.submobjects:
submob.print_mobject_family(n_tabs + 1)
submob.print_submobject_family(n_tabs + 1)
# Alignment
def align_data(self, mobject):

View file

@ -51,7 +51,7 @@ class DecimalNumber(VMobject):
)
if self.unit is not None:
self.unit_sign = TexMobject(self.unit)
self.unit_sign = TexMobject(self.unit, color = self.color)
self.add(self.unit_sign)
self.arrange_submobjects(

View file

@ -275,6 +275,14 @@ class BulletedList(TextMobject):
else:
other_part.set_fill(opacity=opacity)
class TexMobjectFromPresetString(TexMobject):
def __init__(self, **kwargs):
digest_config(self, kwargs)
TexMobject.__init__(self, self.tex, **kwargs)
self.set_color(self.color)
##########