allow Mobject.scale receive iterable scale_factor

This commit is contained in:
TonyCrane 2022-01-25 14:05:32 +08:00
parent f4eb2724c5
commit 1658438fef
No known key found for this signature in database
GPG key ID: 2313A5058A9C637C

View file

@ -4,6 +4,7 @@ import random
import sys
import moderngl
from functools import wraps
from collections import Iterable
import numpy as np
@ -596,7 +597,10 @@ class Mobject(object):
Otherwise, if about_point is given a value, scaling is done with
respect to that point.
"""
scale_factor = max(scale_factor, min_scale_factor)
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)
self.apply_points_function(
lambda points: scale_factor * points,
about_point=about_point,