mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 11:03:03 +08:00
Add Mobject.set_shape
This commit is contained in:
@ -48,7 +48,7 @@ from manimlib.utils.space_ops import rotation_matrix_transpose
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable, Union, Tuple
|
||||
from typing import Callable, Iterable, Union, Tuple, Optional
|
||||
import numpy.typing as npt
|
||||
from manimlib.typing import ManimColor, Vect3, Vect4, Vect3Array, UniformDict
|
||||
from moderngl.context import Context
|
||||
@ -1168,6 +1168,21 @@ class Mobject(object):
|
||||
self.set_depth(min_depth, **kwargs)
|
||||
return self
|
||||
|
||||
def set_shape(
|
||||
self,
|
||||
width: Optional[float] = None,
|
||||
height: Optional[float] = None,
|
||||
depth: Optional[float] = None,
|
||||
**kwargs
|
||||
):
|
||||
if width is not None:
|
||||
self.set_width(width, stretch=True, **kwargs)
|
||||
if height is not None:
|
||||
self.set_height(height, stretch=True, **kwargs)
|
||||
if depth is not None:
|
||||
self.set_depth(depth, stretch=True, **kwargs)
|
||||
return self
|
||||
|
||||
def set_coord(self, value: float, dim: int, direction: Vect3 = ORIGIN):
|
||||
curr = self.get_coord(dim, direction)
|
||||
shift_vect = np.zeros(self.dim)
|
||||
|
Reference in New Issue
Block a user