Skip to content

Commit c7ef840

Browse files
authored
Video work (#2356)
* Only use -no-pdf for xelatex rendering * Instead of tracking du and dv points on surface, track points off the surface in the normal direction This means that surface shading will not necessarily work well for arbitrary transformations of the surface. But the existing solution was flimsy anyway, and caused annoying issues with singularity points. * Have density of anchor points on arcs depend on arc length * Allow for specifying true normals and orientation of Sphere * Change miter threshold on stroke shader * Add get_start_and_end to DashedLine * Add min_total_width option to DecimalNumber * Have BackgroundRectangle.set_style absorb (and ignore) added configuration Note, this feels suboptimal * Add LineBrace * Update font_size adjustment in Tex * Add scale_factor parameter to BulletedList.fade_all_but * Minor import tweaks * Add play_sound * Small if -> elif update * Always use Group for FadeTransform * Use time_spanned_alpha in ChangingDecimal * Change priority of number_config vs. self.decimal_number_config in NumberLine init * Fix clock animation * Allow sample_coords to be passed into VectorField
1 parent f473782 commit c7ef840

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

manimlib/animation/composition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(
4343
mobs = remove_list_redundancies([a.mobject for a in self.animations])
4444
if group is not None:
4545
self.group = group
46-
if group_type is not None:
46+
elif group_type is not None:
4747
self.group = group_type(*mobs)
4848
elif all(isinstance(anim.mobject, VMobject) for anim in animations):
4949
self.group = VGroup(*mobs)

manimlib/animation/fading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from manimlib.animation.transform import Transform
77
from manimlib.constants import ORIGIN
88
from manimlib.mobject.types.vectorized_mobject import VMobject
9+
from manimlib.mobject.mobject import Group
910
from manimlib.utils.bezier import interpolate
1011
from manimlib.utils.rate_functions import there_and_back
1112

@@ -101,7 +102,7 @@ def __init__(
101102
self.dim_to_match = dim_to_match
102103

103104
mobject.save_state()
104-
super().__init__(mobject.get_group_class()(mobject, target_mobject.copy()), **kwargs)
105+
super().__init__(Group(mobject, target_mobject.copy()), **kwargs)
105106

106107
def begin(self) -> None:
107108
self.ending_mobject = self.mobject.copy()

manimlib/animation/numbers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def __init__(
2929
self.mobject = decimal_mob
3030

3131
def interpolate_mobject(self, alpha: float) -> None:
32-
self.mobject.set_value(
33-
self.number_update_func(alpha)
34-
)
32+
true_alpha = self.time_spanned_alpha(alpha)
33+
new_value = self.number_update_func(true_alpha)
34+
self.mobject.set_value(new_value)
3535

3636

3737
class ChangeDecimalToValue(ChangingDecimal):

manimlib/mobject/number_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def get_number_mobject(
164164
**number_config
165165
) -> DecimalNumber:
166166
number_config = merge_dicts_recursively(
167-
number_config, self.decimal_number_config,
167+
self.decimal_number_config, number_config,
168168
)
169169
if direction is None:
170170
direction = self.line_to_number_direction

manimlib/mobject/svg/drawings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ def __init__(
344344
angle=12 * hour_radians,
345345
**rot_kwargs
346346
),
347+
group=clock,
348+
run_time=run_time,
347349
**kwargs
348350
)
349351

manimlib/mobject/vector_field.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def __init__(
145145
func: Callable[[VectArray], VectArray],
146146
# Typically a set of Axes or NumberPlane
147147
coordinate_system: CoordinateSystem,
148+
sample_coords: Optional[VectArray] = None,
148149
density: float = 2.0,
149150
magnitude_range: Optional[Tuple[float, float]] = None,
150151
color: Optional[ManimColor] = None,
@@ -168,14 +169,17 @@ def __init__(
168169
self.norm_to_opacity_func = norm_to_opacity_func
169170

170171
# Search for sample_points
171-
self.sample_coords = get_sample_coords(coordinate_system, density)
172+
if sample_coords is not None:
173+
self.sample_coords = sample_coords
174+
else:
175+
self.sample_coords = get_sample_coords(coordinate_system, density)
172176
self.update_sample_points()
173177

174178
if max_vect_len is None:
175179
step_size = get_norm(self.sample_points[1] - self.sample_points[0])
176180
self.max_displayed_vect_len = max_vect_len_to_step_size * step_size
177181
else:
178-
self.max_displayed_vect_len = max_vect_len * coordinate_system.get_x_unit_size()
182+
self.max_displayed_vect_len = max_vect_len * coordinate_system.x_axis.get_unit_size()
179183

180184
# Prepare the color map
181185
if magnitude_range is None:
@@ -406,7 +410,7 @@ def get_sample_coords(self):
406410

407411
noise_factor = self.noise_factor
408412
if noise_factor is None:
409-
noise_factor = (cs.get_x_unit_size() / self.density) * 0.5
413+
noise_factor = (cs.x_axis.get_unit_size() / self.density) * 0.5
410414

411415
return np.array([
412416
coords + noise_factor * np.random.random(coords.shape)

0 commit comments

Comments
 (0)