mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Define ManimColor type in constants
This commit is contained in:
parent
a7bf10c570
commit
958002152e
16 changed files with 31 additions and 59 deletions
|
@ -34,13 +34,9 @@ from manimlib.utils.rate_functions import wiggle
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
from manimlib.constants import ManimColor
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class FocusOn(Transform):
|
||||
CONFIG = {
|
||||
|
|
|
@ -19,14 +19,10 @@ from manimlib.utils.rate_functions import squish_rate_func
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Union
|
||||
|
||||
from typing import Callable
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
class Transform(Animation):
|
||||
|
|
|
@ -84,6 +84,13 @@ CTRL_MODIFIER = 2
|
|||
COMMAND_MODIFIER = 64
|
||||
|
||||
# Colors
|
||||
from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from typing import Union
|
||||
from colour import Color
|
||||
ManimColor = Union[str, Color, None]
|
||||
|
||||
|
||||
BLUE_E = "#1C758A"
|
||||
BLUE_D = "#29ABCA"
|
||||
BLUE_C = "#58C4DD"
|
||||
|
|
|
@ -33,13 +33,11 @@ from manimlib.utils.space_ops import normalize
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Type, TypeVar, Union
|
||||
|
||||
from typing import Callable, Iterable, Sequence, Type, TypeVar
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
T = TypeVar("T", bound=Mobject)
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
EPSILON = 1e-8
|
||||
|
|
|
@ -30,10 +30,8 @@ from manimlib.utils.space_ops import rotation_matrix_transpose
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from typing import Iterable
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
DEFAULT_DOT_RADIUS = 0.08
|
||||
|
|
|
@ -18,14 +18,9 @@ from manimlib.mobject.types.vectorized_mobject import VMobject
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
VECTOR_LABEL_SCALE_FACTOR = 0.8
|
||||
|
|
|
@ -47,7 +47,6 @@ from manimlib.utils.space_ops import rotation_matrix_transpose
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
@ -55,7 +54,7 @@ if TYPE_CHECKING:
|
|||
TimeBasedUpdater = Callable[["Mobject", float], None]
|
||||
NonTimeUpdater = Callable[["Mobject"], None]
|
||||
Updater = Union[TimeBasedUpdater, NonTimeUpdater]
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
class Mobject(object):
|
||||
|
@ -333,7 +332,7 @@ class Mobject(object):
|
|||
parent.assemble_family()
|
||||
return self
|
||||
|
||||
def get_family(self, recurse: bool = True):
|
||||
def get_family(self, recurse: bool = True) -> list[Mobject]:
|
||||
if recurse:
|
||||
return self.family
|
||||
else:
|
||||
|
|
|
@ -18,10 +18,8 @@ from manimlib.utils.iterables import listify
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from typing import Iterable
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
EPSILON = 0.0001
|
||||
|
|
|
@ -15,11 +15,8 @@ from manimlib.utils.customization import get_customization
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Union
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
class SurroundingRectangle(Rectangle):
|
||||
|
|
|
@ -9,13 +9,12 @@ from manimlib.utils.tex_file_writing import tex_content_to_svg_file
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
import re
|
||||
from typing import Iterable, Union
|
||||
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
Span = tuple[int, int]
|
||||
Selector = Union[
|
||||
str,
|
||||
|
|
|
@ -17,10 +17,9 @@ from manimlib.utils.config_ops import digest_config
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Union
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
Span = tuple[int, int]
|
||||
Selector = Union[
|
||||
str,
|
||||
|
|
|
@ -18,10 +18,8 @@ from manimlib.utils.tex_file_writing import tex_content_to_svg_file
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from typing import Iterable
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
SCALE_FACTOR_PER_FONT_POINT = 0.001
|
||||
|
|
|
@ -23,12 +23,10 @@ from manimlib.utils.simple_functions import hash_string
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
Span = tuple[int, int]
|
||||
Selector = Union[
|
||||
str,
|
||||
|
|
|
@ -13,12 +13,9 @@ from manimlib.utils.iterables import resize_with_interpolation
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Union
|
||||
|
||||
from typing import Callable
|
||||
import numpy.typing as npt
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
class PMobject(Mobject):
|
||||
|
|
|
@ -42,12 +42,10 @@ from manimlib.shader_wrapper import ShaderWrapper
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Union
|
||||
from typing import Callable, Iterable, Sequence
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
class VMobject(Mobject):
|
||||
|
|
|
@ -13,9 +13,8 @@ from manimlib.utils.iterables import resize_with_interpolation
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from typing import Iterable
|
||||
from manimlib.constants import ManimColor
|
||||
|
||||
|
||||
def color_to_rgb(color: ManimColor) -> np.ndarray:
|
||||
|
|
Loading…
Add table
Reference in a new issue