mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
allow Mobject.scale receive iterable scale_factor
This commit is contained in:
parent
f4eb2724c5
commit
1658438fef
1 changed files with 5 additions and 1 deletions
|
@ -4,6 +4,7 @@ import random
|
||||||
import sys
|
import sys
|
||||||
import moderngl
|
import moderngl
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from collections import Iterable
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -596,6 +597,9 @@ class Mobject(object):
|
||||||
Otherwise, if about_point is given a value, scaling is done with
|
Otherwise, if about_point is given a value, scaling is done with
|
||||||
respect to that point.
|
respect to that point.
|
||||||
"""
|
"""
|
||||||
|
if isinstance(scale_factor, Iterable):
|
||||||
|
scale_factor = np.array(scale_factor).clip(min=min_scale_factor)
|
||||||
|
else:
|
||||||
scale_factor = max(scale_factor, min_scale_factor)
|
scale_factor = max(scale_factor, min_scale_factor)
|
||||||
self.apply_points_function(
|
self.apply_points_function(
|
||||||
lambda points: scale_factor * points,
|
lambda points: scale_factor * points,
|
||||||
|
|
Loading…
Add table
Reference in a new issue