mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 21:44:19 +08:00
Random fixes to some old_projects
This commit is contained in:
@ -640,10 +640,7 @@ class ColorMappedByFuncScene(Scene):
|
||||
}
|
||||
|
||||
def short_path_to_long_path(self, filename_with_ext):
|
||||
return os.path.join(
|
||||
self.output_directory, "images",
|
||||
filename_with_ext
|
||||
)
|
||||
return self.get_image_file_path(filename_with_ext)
|
||||
|
||||
def setup(self):
|
||||
# The composition of input_to_pos and pos_to_color
|
||||
@ -664,11 +661,13 @@ class ColorMappedByFuncScene(Scene):
|
||||
jitter_val = 0.1
|
||||
line_coords = np.linspace(-10, 10) + jitter_val
|
||||
func_hash_points = it.product(line_coords, line_coords)
|
||||
|
||||
def mini_hasher(p):
|
||||
rgba = point_to_rgba(self.pixel_pos_to_color_func(p))
|
||||
if rgba[3] != 1.0:
|
||||
print("Warning! point_to_rgba assigns fractional alpha", rgba[3])
|
||||
return tuple(rgba)
|
||||
|
||||
to_hash = tuple(mini_hasher(p) for p in func_hash_points)
|
||||
func_hash = hash(to_hash)
|
||||
# We hash just based on output image
|
||||
@ -695,7 +694,7 @@ class ColorMappedByFuncScene(Scene):
|
||||
)
|
||||
)
|
||||
)
|
||||
self.save_image(self.background_image_file, mode = "RGBA")
|
||||
self.save_image(self.background_image_file, mode="RGBA")
|
||||
|
||||
if self.hide_background:
|
||||
# Clearing background
|
||||
|
@ -768,10 +768,10 @@ class InputOutputScene(Scene):
|
||||
|
||||
def get_planes(self):
|
||||
input_plane = self.input_plane = NumberPlane(
|
||||
x_radius = self.plane_width/2.0,
|
||||
y_radius = self.plane_height/2.0,
|
||||
x_radius = self.plane_width / 2.0,
|
||||
y_radius = self.plane_height / 2.0,
|
||||
)
|
||||
output_plane = self.output_plane = input_plane.copy()
|
||||
output_plane = self.output_plane = input_plane.deepcopy()
|
||||
planes = VGroup(input_plane, output_plane)
|
||||
vects = [LEFT, RIGHT]
|
||||
label_texts = ["Input", "Output"]
|
||||
@ -780,6 +780,7 @@ class InputOutputScene(Scene):
|
||||
plane.stretch_to_fit_width(self.plane_width)
|
||||
plane.add_coordinates(x_vals = list(range(-2, 3)), y_vals = list(range(-2, 3)))
|
||||
plane.white_parts = VGroup(plane.axes, plane.coordinate_labels)
|
||||
plane.coordinate_labels.set_background_stroke(width=0)
|
||||
plane.lines_to_fade = VGroup(plane.main_lines, plane.secondary_lines)
|
||||
plane.move_to(vect*FRAME_X_RADIUS/2 + self.y_shift*DOWN)
|
||||
label = TextMobject(text)
|
||||
@ -1452,6 +1453,7 @@ class SearchForZerosInInputSpace(ColorMappedObjectsScene):
|
||||
"func" : example_plane_func,
|
||||
}
|
||||
def construct(self):
|
||||
ColorMappedObjectsScene.construct(self)
|
||||
title = TextMobject("Input space")
|
||||
title.scale(2)
|
||||
title.to_edge(UP)
|
||||
@ -1540,7 +1542,7 @@ class OneDRegionBoundary(Scene):
|
||||
color = color,
|
||||
buff = 0
|
||||
)
|
||||
for x, fx, color in (x0, fx0, RED), (x1, fx1, GREEN)
|
||||
for x, fx, color in [(x0, fx0, RED), (x1, fx1, GREEN)]
|
||||
])
|
||||
minus = TexMobject("-")
|
||||
minus.match_color(x0_arrow)
|
||||
@ -3246,33 +3248,3 @@ class Thumbnail(SearchSpacePerimeterVsArea):
|
||||
self.clear()
|
||||
self.add(lines)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -858,7 +858,7 @@ class ShowMeasurementBook(TeacherStudentsScene):
|
||||
measurement.move_to(self.hold_up_spot, DOWN)
|
||||
|
||||
words = TextMobject("Highly recommended")
|
||||
arrow = Vector(RIGHT, buff=WHITE)
|
||||
arrow = Vector(RIGHT, color=WHITE)
|
||||
arrow.next_to(measurement, LEFT)
|
||||
words.next_to(arrow, LEFT)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from constants import *
|
||||
import scipy
|
||||
import scipy.integrate
|
||||
|
||||
from big_ol_pile_of_manim_imports import *
|
||||
|
||||
@ -1633,9 +1633,9 @@ class DrawFrequencyPlot(WrapCosineGraphAroundCircle, PiCreatureScene):
|
||||
|
||||
def change_frequency(self, new_freq, **kwargs):
|
||||
kwargs["run_time"] = kwargs.get("run_time", 3)
|
||||
rate_func = kwargs.pop(
|
||||
"rate_func", bezier([0, 0, 1, 1])
|
||||
)
|
||||
rate_func = kwargs.pop("rate_func", None)
|
||||
if rate_func is None:
|
||||
rate_func = bezier([0, 0, 1, 1])
|
||||
added_anims = kwargs.get("added_anims", [])
|
||||
anims = [self.get_frequency_change_animation(self.graph, new_freq)]
|
||||
if hasattr(self, "winding_freq_label"):
|
||||
@ -3782,7 +3782,7 @@ class SummarizeFormula(Scene):
|
||||
expression.get_part_by_tex(p1),
|
||||
expression.get_part_by_tex(p2),
|
||||
))
|
||||
for p1, p2 in ("e", "t}"), ("g({}", "t}"), ("\\int", "dt")
|
||||
for p1, p2 in [("e", "t}"), ("g({}", "t}"), ("\\int", "dt")]
|
||||
]
|
||||
|
||||
self.add(expression)
|
||||
@ -4005,7 +4005,7 @@ class ShowUncertaintyPrinciple(Scene):
|
||||
self.wait(2)
|
||||
self.add(*[
|
||||
ContinualUpdateFromFunc(graph, get_update_func(axes))
|
||||
for graph, axes in (top_graph, top_axes), (bottom_graph, bottom_axes)
|
||||
for graph, axes in [(top_graph, top_axes), (bottom_graph, bottom_axes)]
|
||||
])
|
||||
for factor in factors:
|
||||
self.play(
|
||||
|
@ -158,7 +158,7 @@ class ShowEmergingEllipse(Scene):
|
||||
|
||||
fade_rect = FullScreenFadeRectangle()
|
||||
|
||||
line = lines[len(lines) / 5]
|
||||
line = lines[len(lines) // 5]
|
||||
line_dot = Dot(line.get_center(), color=YELLOW)
|
||||
line_dot.scale(0.5)
|
||||
|
||||
|
Reference in New Issue
Block a user