mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Sort imports
This commit is contained in:
parent
0cf3199578
commit
9ef9961d0e
72 changed files with 527 additions and 355 deletions
|
@ -20,17 +20,16 @@ from manimlib.animation.update import *
|
|||
|
||||
from manimlib.camera.camera import *
|
||||
|
||||
from manimlib.window import *
|
||||
|
||||
from manimlib.mobject.boolean_ops import *
|
||||
from manimlib.mobject.coordinate_systems import *
|
||||
from manimlib.mobject.changing import *
|
||||
from manimlib.mobject.coordinate_systems import *
|
||||
from manimlib.mobject.frame import *
|
||||
from manimlib.mobject.functions import *
|
||||
from manimlib.mobject.geometry import *
|
||||
from manimlib.mobject.interactive import *
|
||||
from manimlib.mobject.matrix import *
|
||||
from manimlib.mobject.mobject import *
|
||||
from manimlib.mobject.mobject_update_utils import *
|
||||
from manimlib.mobject.number_line import *
|
||||
from manimlib.mobject.numbers import *
|
||||
from manimlib.mobject.probability import *
|
||||
|
@ -43,12 +42,11 @@ from manimlib.mobject.svg.svg_mobject import *
|
|||
from manimlib.mobject.svg.tex_mobject import *
|
||||
from manimlib.mobject.svg.text_mobject import *
|
||||
from manimlib.mobject.three_dimensions import *
|
||||
from manimlib.mobject.types.dot_cloud import *
|
||||
from manimlib.mobject.types.image_mobject import *
|
||||
from manimlib.mobject.types.point_cloud_mobject import *
|
||||
from manimlib.mobject.types.surface import *
|
||||
from manimlib.mobject.types.vectorized_mobject import *
|
||||
from manimlib.mobject.types.dot_cloud import *
|
||||
from manimlib.mobject.mobject_update_utils import *
|
||||
from manimlib.mobject.value_tracker import *
|
||||
from manimlib.mobject.vector_field import *
|
||||
|
||||
|
@ -61,11 +59,13 @@ from manimlib.utils.config_ops import *
|
|||
from manimlib.utils.customization import *
|
||||
from manimlib.utils.debug import *
|
||||
from manimlib.utils.directories import *
|
||||
from manimlib.utils.file_ops import *
|
||||
from manimlib.utils.images import *
|
||||
from manimlib.utils.iterables import *
|
||||
from manimlib.utils.file_ops import *
|
||||
from manimlib.utils.paths import *
|
||||
from manimlib.utils.rate_functions import *
|
||||
from manimlib.utils.simple_functions import *
|
||||
from manimlib.utils.sounds import *
|
||||
from manimlib.utils.space_ops import *
|
||||
|
||||
from manimlib.window import *
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
import manimlib.config
|
||||
import manimlib.logger
|
||||
import manimlib.extract_scene
|
||||
import manimlib.utils.init_config
|
||||
from manimlib import __version__
|
||||
import manimlib.config
|
||||
import manimlib.extract_scene
|
||||
import manimlib.logger
|
||||
import manimlib.utils.init_config
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from copy import deepcopy
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.mobject.mobject import _AnimationBuilder
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
@ -12,6 +11,8 @@ from manimlib.utils.simple_functions import clip
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.animation.animation import Animation, prepare_animation
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.animation.animation import prepare_animation
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
from manimlib.utils.bezier import interpolate
|
||||
|
@ -15,8 +15,10 @@ from manimlib.utils.simple_functions import clip
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.scene.scene import Scene
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
DEFAULT_LAGGED_START_LAG_RATIO = 0.05
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools as it
|
||||
from abc import abstractmethod
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.animation.composition import Succession
|
||||
from manimlib.mobject.svg.labelled_string import LabelledString
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
|
@ -18,10 +16,10 @@ from manimlib.utils.rate_functions import smooth
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class ShowPartial(Animation):
|
||||
class ShowPartial(Animation, ABC):
|
||||
"""
|
||||
Abstract class for ShowCreation and ShowPassingFlash
|
||||
"""
|
||||
|
@ -177,7 +175,7 @@ class ShowIncreasingSubsets(Animation):
|
|||
"int_func": np.round,
|
||||
}
|
||||
|
||||
def __init__(self, group: Group, **kwargs):
|
||||
def __init__(self, group: Mobject, **kwargs):
|
||||
self.all_submobs = list(group.submobjects)
|
||||
super().__init__(group, **kwargs)
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@ import numpy as np
|
|||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.constants import ORIGIN
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.rate_functions import there_and_back
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.scene.scene import Scene
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
DEFAULT_FADE_LAG_RATIO = 0
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manimlib.constants import PI
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.constants import PI
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import numpy as np
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
from manimlib.mobject.geometry import Arrow
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class GrowFromPoint(Transform):
|
||||
|
|
|
@ -1,40 +1,43 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from typing import Union, Sequence
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.animation.movement import Homotopy
|
||||
from manimlib.animation.composition import AnimationGroup
|
||||
from manimlib.animation.composition import Succession
|
||||
from manimlib.animation.creation import ShowCreation
|
||||
from manimlib.animation.creation import ShowPartial
|
||||
from manimlib.animation.fading import FadeOut
|
||||
from manimlib.animation.fading import FadeIn
|
||||
from manimlib.animation.movement import Homotopy
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.constants import ORIGIN, RIGHT, UP
|
||||
from manimlib.constants import SMALL_BUFF
|
||||
from manimlib.constants import TAU
|
||||
from manimlib.constants import GREY, YELLOW
|
||||
from manimlib.mobject.geometry import Circle
|
||||
from manimlib.mobject.geometry import Dot
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.shape_matchers import SurroundingRectangle
|
||||
from manimlib.mobject.shape_matchers import Underline
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.rate_functions import there_and_back
|
||||
from manimlib.utils.rate_functions import wiggle
|
||||
from manimlib.utils.rate_functions import smooth
|
||||
from manimlib.utils.rate_functions import squish_rate_func
|
||||
from manimlib.utils.rate_functions import there_and_back
|
||||
from manimlib.utils.rate_functions import wiggle
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import colour
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class FocusOn(Transform):
|
||||
|
@ -217,7 +220,7 @@ class VShowPassingFlash(Animation):
|
|||
if abs(x - mu) > 3 * sigma:
|
||||
return 0
|
||||
z = (x - mu) / sigma
|
||||
return math.exp(-0.5 * z * z)
|
||||
return np.exp(-0.5 * z * z)
|
||||
|
||||
kernel_array = list(map(gauss_kernel, np.linspace(0, 1, len(anchor_widths))))
|
||||
scaled_widths = anchor_widths * kernel_array
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Sequence
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.utils.rate_functions import linear
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Sequence
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.mobject.numbers import DecimalNumber
|
||||
from manimlib.utils.bezier import interpolate
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
|
||||
class ChangingDecimal(Animation):
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.constants import OUT
|
||||
from manimlib.constants import PI
|
||||
from manimlib.constants import TAU
|
||||
from manimlib.constants import ORIGIN
|
||||
from manimlib.constants import ORIGIN, OUT
|
||||
from manimlib.constants import PI, TAU
|
||||
from manimlib.utils.rate_functions import linear
|
||||
from manimlib.utils.rate_functions import smooth
|
||||
|
||||
|
@ -12,6 +10,7 @@ from typing import TYPE_CHECKING
|
|||
|
||||
if TYPE_CHECKING:
|
||||
import numpy as np
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.animation.composition import LaggedStart
|
||||
from manimlib.animation.transform import Restore
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.constants import BLACK, WHITE
|
||||
from manimlib.mobject.geometry import Circle
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import numpy as np
|
||||
|
||||
|
||||
class Broadcast(LaggedStart):
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
from typing import Callable, Union, Sequence
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.constants import DEFAULT_POINTWISE_FUNCTION_RUN_TIME
|
||||
from manimlib.constants import OUT
|
||||
from manimlib.constants import DEGREES
|
||||
from manimlib.constants import OUT
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
|
@ -21,9 +19,14 @@ from manimlib.utils.rate_functions import squish_rate_func
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import colour
|
||||
from colour import Color
|
||||
from typing import Callable, Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.scene.scene import Scene
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class Transform(Animation):
|
||||
|
|
|
@ -5,9 +5,9 @@ import itertools as it
|
|||
import numpy as np
|
||||
|
||||
from manimlib.animation.composition import AnimationGroup
|
||||
from manimlib.animation.fading import FadeTransformPieces
|
||||
from manimlib.animation.fading import FadeInFromPoint
|
||||
from manimlib.animation.fading import FadeOutToPoint
|
||||
from manimlib.animation.fading import FadeTransformPieces
|
||||
from manimlib.animation.transform import ReplacementTransform
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
@ -16,13 +16,13 @@ from manimlib.mobject.svg.labelled_string import LabelledString
|
|||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import remove_list_redundancies
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.svg.tex_mobject import SingleStringTex
|
||||
from manimlib.mobject.svg.tex_mobject import Tex
|
||||
from manimlib.scene.scene import Scene
|
||||
from manimlib.mobject.svg.tex_mobject import Tex, SingleStringTex
|
||||
|
||||
|
||||
class TransformMatchingParts(AnimationGroup):
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import operator as op
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
@ -47,10 +46,7 @@ class MaintainPositionRelativeTo(Animation):
|
|||
**kwargs
|
||||
):
|
||||
self.tracked_mobject = tracked_mobject
|
||||
self.diff = op.sub(
|
||||
mobject.get_center(),
|
||||
tracked_mobject.get_center(),
|
||||
)
|
||||
self.diff = mobject.get_center() - tracked_mobject.get_center()
|
||||
super().__init__(mobject, **kwargs)
|
||||
|
||||
def interpolate_mobject(self, alpha: float) -> None:
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import moderngl
|
||||
from colour import Color
|
||||
import OpenGL.GL as gl
|
||||
import itertools as it
|
||||
import math
|
||||
|
||||
import itertools as it
|
||||
|
||||
import moderngl
|
||||
import numpy as np
|
||||
from scipy.spatial.transform import Rotation
|
||||
import OpenGL.GL as gl
|
||||
from PIL import Image
|
||||
from scipy.spatial.transform import Rotation
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.constants import DEGREES, RADIANS
|
||||
from manimlib.constants import DEFAULT_FRAME_RATE
|
||||
from manimlib.constants import DEFAULT_PIXEL_HEIGHT, DEFAULT_PIXEL_WIDTH
|
||||
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
|
||||
from manimlib.constants import DOWN, LEFT, ORIGIN, OUT, RIGHT, UP
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.mobject import Point
|
||||
from manimlib.utils.color import color_to_rgba
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.simple_functions import fdiv
|
||||
from manimlib.utils.space_ops import normalize
|
||||
|
@ -180,10 +184,9 @@ class Camera(object):
|
|||
def __init__(self, ctx: moderngl.Context | None = None, **kwargs):
|
||||
digest_config(self, kwargs, locals())
|
||||
self.rgb_max_val: float = np.iinfo(self.pixel_array_dtype).max
|
||||
self.background_rgba: list[float] = [
|
||||
*Color(self.background_color).get_rgb(),
|
||||
self.background_opacity
|
||||
]
|
||||
self.background_rgba: list[float] = list(color_to_rgba(
|
||||
self.background_color, self.background_opacity
|
||||
))
|
||||
self.init_frame()
|
||||
self.init_context(ctx)
|
||||
self.init_shaders()
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import argparse
|
||||
import colour
|
||||
import inspect
|
||||
from contextlib import contextmanager
|
||||
import importlib
|
||||
import inspect
|
||||
import os
|
||||
from screeninfo import get_monitors
|
||||
import sys
|
||||
import yaml
|
||||
from contextlib import contextmanager
|
||||
from screeninfo import get_monitors
|
||||
|
||||
from manimlib.logger import log
|
||||
from manimlib.utils.config_ops import merge_dicts_recursively
|
||||
from manimlib.utils.init_config import init_customization
|
||||
from manimlib.logger import log
|
||||
|
||||
|
||||
__config_file__ = "custom_config.yml"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import numpy as np
|
||||
|
||||
|
||||
# Sizes relevant to default camera frame
|
||||
ASPECT_RATIO = 16.0 / 9.0
|
||||
FRAME_HEIGHT = 8.0
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
from manimlib.event_handler.event_listner import EventListner
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
|
||||
|
||||
class EventDispatcher(object):
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class EventListner(object):
|
||||
def __init__(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import copy
|
||||
import inspect
|
||||
import sys
|
||||
import copy
|
||||
|
||||
from manimlib.scene.scene import Scene
|
||||
from manimlib.config import get_custom_config
|
||||
from manimlib.logger import log
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
class BlankScene(Scene):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
|
||||
from rich.logging import RichHandler
|
||||
|
||||
__all__ = ["log"]
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import BLUE_D
|
||||
from manimlib.constants import BLUE_B
|
||||
from manimlib.constants import BLUE_E
|
||||
from manimlib.constants import GREY_BROWN
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.constants import BLUE_B, BLUE_D, BLUE_E, GREY_BROWN, WHITE
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.rate_functions import smooth
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
|
||||
class AnimatedBoundary(VGroup):
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
import numbers
|
||||
from abc import abstractmethod
|
||||
from typing import Type, TypeVar, Union, Callable, Iterable, Sequence
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK, BLUE, BLUE_D, GREEN, GREY_A, WHITE
|
||||
from manimlib.constants import DEGREES, PI
|
||||
from manimlib.constants import DL, DOWN, DR, LEFT, ORIGIN, OUT, RIGHT, UP
|
||||
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
|
||||
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
|
||||
from manimlib.constants import MED_SMALL_BUFF, SMALL_BUFF
|
||||
from manimlib.mobject.functions import ParametricCurve
|
||||
from manimlib.mobject.geometry import Arrow
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import DashedLine
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
from manimlib.mobject.number_line import NumberLine
|
||||
from manimlib.mobject.svg.tex_mobject import Tex
|
||||
|
@ -25,16 +29,19 @@ from manimlib.utils.space_ops import rotate_vector
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import colour
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Type, TypeVar, Union
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
T = TypeVar("T", bound=Mobject)
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
EPSILON = 1e-8
|
||||
|
||||
|
||||
class CoordinateSystem():
|
||||
class CoordinateSystem(ABC):
|
||||
"""
|
||||
Abstract class for Axes and NumberPlane
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK, GREY_E
|
||||
from manimlib.constants import FRAME_HEIGHT
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Sequence
|
||||
|
||||
from isosurfaces import plot_isoline
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
|
||||
from manimlib.constants import YELLOW
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Sequence
|
||||
|
||||
|
||||
class ParametricCurve(VMobject):
|
||||
CONFIG = {
|
||||
|
|
|
@ -2,23 +2,24 @@ from __future__ import annotations
|
|||
|
||||
import math
|
||||
import numbers
|
||||
from typing import Sequence, Union
|
||||
|
||||
import colour
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DOWN, LEFT, ORIGIN, OUT, RIGHT, UP
|
||||
from manimlib.constants import GREY_A, RED, WHITE
|
||||
from manimlib.constants import MED_SMALL_BUFF
|
||||
from manimlib.constants import PI, TAU
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.types.vectorized_mobject import DashedVMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import DashedVMobject
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import adjacent_n_tuples
|
||||
from manimlib.utils.iterables import adjacent_pairs
|
||||
from manimlib.utils.simple_functions import fdiv
|
||||
from manimlib.utils.simple_functions import clip
|
||||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.simple_functions import fdiv
|
||||
from manimlib.utils.space_ops import angle_between_vectors
|
||||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.space_ops import compass_directions
|
||||
from manimlib.utils.space_ops import find_intersection
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
|
@ -26,7 +27,13 @@ from manimlib.utils.space_ops import normalize
|
|||
from manimlib.utils.space_ops import rotate_vector
|
||||
from manimlib.utils.space_ops import rotation_matrix_transpose
|
||||
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
DEFAULT_DOT_RADIUS = 0.08
|
||||
|
@ -716,8 +723,8 @@ class Arrow(Line):
|
|||
|
||||
def set_stroke(
|
||||
self,
|
||||
color: ManimColor | None = None,
|
||||
width: float | None = None,
|
||||
color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
width: float | Iterable[float] | None = None,
|
||||
*args, **kwargs
|
||||
):
|
||||
super().set_stroke(color=color, width=width, *args, **kwargs)
|
||||
|
|
|
@ -1,22 +1,32 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable
|
||||
|
||||
import numpy as np
|
||||
from pyglet.window import key as PygletWindowKeys
|
||||
|
||||
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
|
||||
from manimlib.constants import LEFT, RIGHT, UP, DOWN, ORIGIN
|
||||
from manimlib.constants import SMALL_BUFF, MED_SMALL_BUFF, MED_LARGE_BUFF
|
||||
from manimlib.constants import BLACK, GREY_A, GREY_C, RED, GREEN, BLUE, WHITE
|
||||
from manimlib.mobject.mobject import Mobject, Group
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.geometry import Dot, Line, Square, Rectangle, RoundedRectangle, Circle
|
||||
from manimlib.constants import DOWN, LEFT, ORIGIN, RIGHT, UP
|
||||
from manimlib.constants import MED_LARGE_BUFF, MED_SMALL_BUFF, SMALL_BUFF
|
||||
from manimlib.constants import BLACK, BLUE, GREEN, GREY_A, GREY_C, RED, WHITE
|
||||
from manimlib.mobject.mobject import Group
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.geometry import Circle
|
||||
from manimlib.mobject.geometry import Dot
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
from manimlib.mobject.geometry import RoundedRectangle
|
||||
from manimlib.mobject.geometry import Square
|
||||
from manimlib.mobject.svg.text_mobject import Text
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.value_tracker import ValueTracker
|
||||
from manimlib.utils.color import rgb_to_hex
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.space_ops import get_norm, get_closest_point_on_line
|
||||
from manimlib.utils.color import rgb_to_color, color_to_rgba, rgb_to_hex
|
||||
from manimlib.utils.space_ops import get_closest_point_on_line
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
|
||||
# Interactive Mobjects
|
||||
|
@ -336,7 +346,7 @@ class ColorSliders(Group):
|
|||
g = self.g_slider.get_value() / 255
|
||||
b = self.b_slider.get_value() / 255
|
||||
alpha = self.a_slider.get_value()
|
||||
return color_to_rgba(rgb_to_color((r, g, b)), alpha=alpha)
|
||||
return np.array((r, g, b, alpha))
|
||||
|
||||
def get_picked_color(self) -> str:
|
||||
rgba = self.get_value()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools as it
|
||||
from typing import Union, Sequence
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER
|
||||
from manimlib.constants import DOWN, LEFT, RIGHT, UP
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.mobject.numbers import DecimalNumber
|
||||
from manimlib.mobject.numbers import Integer
|
||||
from manimlib.mobject.shape_matchers import BackgroundRectangle
|
||||
|
@ -18,9 +18,14 @@ from manimlib.mobject.types.vectorized_mobject import VMobject
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import colour
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
VECTOR_LABEL_SCALE_FACTOR = 0.8
|
||||
|
|
|
@ -5,44 +5,54 @@ import copy
|
|||
import random
|
||||
import itertools as it
|
||||
from functools import wraps
|
||||
from typing import Iterable, Callable, Union, Sequence
|
||||
|
||||
import colour
|
||||
import moderngl
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DEFAULT_MOBJECT_TO_EDGE_BUFFER
|
||||
from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER
|
||||
from manimlib.constants import DOWN, IN, LEFT, ORIGIN, OUT, RIGHT, UP
|
||||
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
|
||||
from manimlib.constants import MED_SMALL_BUFF
|
||||
from manimlib.constants import TAU
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.event_handler import EVENT_DISPATCHER
|
||||
from manimlib.event_handler.event_listner import EventListner
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
from manimlib.shader_wrapper import get_colormap_code
|
||||
from manimlib.shader_wrapper import ShaderWrapper
|
||||
from manimlib.utils.color import color_gradient
|
||||
from manimlib.utils.color import color_to_rgb
|
||||
from manimlib.utils.color import get_colormap_list
|
||||
from manimlib.utils.color import rgb_to_hex
|
||||
from manimlib.utils.color import color_to_rgb
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import batch_by_property
|
||||
from manimlib.utils.iterables import list_update
|
||||
from manimlib.utils.iterables import listify
|
||||
from manimlib.utils.iterables import make_even
|
||||
from manimlib.utils.iterables import resize_array
|
||||
from manimlib.utils.iterables import resize_preserving_order
|
||||
from manimlib.utils.iterables import resize_with_interpolation
|
||||
from manimlib.utils.iterables import make_even
|
||||
from manimlib.utils.iterables import listify
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.paths import straight_path
|
||||
from manimlib.utils.simple_functions import get_parameters
|
||||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
from manimlib.utils.space_ops import rotation_matrix_transpose
|
||||
from manimlib.shader_wrapper import ShaderWrapper
|
||||
from manimlib.shader_wrapper import get_colormap_code
|
||||
from manimlib.event_handler import EVENT_DISPATCHER
|
||||
from manimlib.event_handler.event_listner import EventListner
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
TimeBasedUpdater = Callable[["Mobject", float], None]
|
||||
NonTimeUpdater = Callable[["Mobject"], None]
|
||||
Updater = Union[TimeBasedUpdater, NonTimeUpdater]
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
TimeBasedUpdater = Callable[["Mobject", float], None]
|
||||
NonTimeUpdater = Callable[["Mobject"], None]
|
||||
Updater = Union[TimeBasedUpdater, NonTimeUpdater]
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class Mobject(object):
|
||||
|
@ -635,7 +645,7 @@ class Mobject(object):
|
|||
|
||||
def scale(
|
||||
self,
|
||||
scale_factor: float | npt.ArrayLike,
|
||||
scale_factor: float | Iterable[float],
|
||||
min_scale_factor: float = 1e-8,
|
||||
about_point: np.ndarray | None = None,
|
||||
about_edge: np.ndarray = ORIGIN
|
||||
|
@ -649,10 +659,7 @@ class Mobject(object):
|
|||
Otherwise, if about_point is given a value, scaling is done with
|
||||
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 = np.resize(scale_factor, self.dim).clip(min=min_scale_factor)
|
||||
self.apply_points_function(
|
||||
lambda points: scale_factor * points,
|
||||
about_point=about_point,
|
||||
|
@ -1038,8 +1045,8 @@ class Mobject(object):
|
|||
|
||||
def set_rgba_array_by_color(
|
||||
self,
|
||||
color: ManimColor | None = None,
|
||||
opacity: float | None = None,
|
||||
color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
opacity: float | Iterable[float] | None = None,
|
||||
name: str = "rgbas",
|
||||
recurse: bool = True
|
||||
):
|
||||
|
@ -1061,7 +1068,12 @@ class Mobject(object):
|
|||
mob.data[name][:, 3] = resize_array(opacities, size)
|
||||
return self
|
||||
|
||||
def set_color(self, color: ManimColor, opacity: float | None = None, recurse: bool = True):
|
||||
def set_color(
|
||||
self,
|
||||
color: ManimColor | Iterable[ManimColor] | None,
|
||||
opacity: float | Iterable[float] | None = None,
|
||||
recurse: bool = True
|
||||
):
|
||||
self.set_rgba_array_by_color(color, opacity, recurse=False)
|
||||
# Recurse to submobjects differently from how set_rgba_array_by_color
|
||||
# in case they implement set_color differently
|
||||
|
@ -1070,7 +1082,11 @@ class Mobject(object):
|
|||
submob.set_color(color, recurse=True)
|
||||
return self
|
||||
|
||||
def set_opacity(self, opacity: float, recurse: bool = True):
|
||||
def set_opacity(
|
||||
self,
|
||||
opacity: float | Iterable[float] | None,
|
||||
recurse: bool = True
|
||||
):
|
||||
self.set_rgba_array_by_color(color=None, opacity=opacity, recurse=False)
|
||||
if recurse:
|
||||
for submob in self.submobjects:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.constants import DEGREES
|
||||
from manimlib.constants import RIGHT
|
||||
|
@ -11,7 +10,10 @@ from manimlib.utils.simple_functions import clip
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Sequence
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DOWN, LEFT, RIGHT, UP
|
||||
from manimlib.constants import GREY_B
|
||||
from manimlib.constants import MED_SMALL_BUFF
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.numbers import DecimalNumber
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
|
@ -12,6 +12,11 @@ from manimlib.utils.config_ops import digest_config
|
|||
from manimlib.utils.config_ops import merge_dicts_recursively
|
||||
from manimlib.utils.simple_functions import fdiv
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable, Sequence
|
||||
|
||||
|
||||
class NumberLine(Line):
|
||||
CONFIG = {
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TypeVar, Type
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DOWN, LEFT, RIGHT, UP
|
||||
from manimlib.mobject.svg.tex_mobject import SingleStringTex
|
||||
from manimlib.mobject.svg.text_mobject import Text
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
|
||||
T = TypeVar("T", bound=VMobject)
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Type, TypeVar
|
||||
|
||||
T = TypeVar("T", bound=VMobject)
|
||||
|
||||
|
||||
class DecimalNumber(VMobject):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Union, Sequence
|
||||
import colour
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLUE, BLUE_E, GREEN_E, GREY_B, GREY_D, MAROON_B, YELLOW
|
||||
from manimlib.constants import DOWN, LEFT, RIGHT, UP
|
||||
from manimlib.constants import MED_LARGE_BUFF, MED_SMALL_BUFF, SMALL_BUFF
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
@ -14,7 +13,14 @@ from manimlib.mobject.types.vectorized_mobject import VGroup
|
|||
from manimlib.utils.color import color_gradient
|
||||
from manimlib.utils.iterables import listify
|
||||
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
EPSILON = 0.0001
|
||||
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from manimlib.constants import *
|
||||
from colour import Color
|
||||
|
||||
from manimlib.constants import BLACK, RED, YELLOW
|
||||
from manimlib.constants import DL, DOWN, DR, LEFT, RIGHT, UL, UR
|
||||
from manimlib.constants import SMALL_BUFF
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.color import Color
|
||||
from manimlib.utils.customization import get_customization
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.customization import get_customization
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Union, Sequence
|
||||
from typing import Union
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
ManimColor = Union[str, Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class SurroundingRectangle(Rectangle):
|
||||
|
|
|
@ -2,27 +2,32 @@ from __future__ import annotations
|
|||
|
||||
import math
|
||||
import copy
|
||||
from typing import Iterable
|
||||
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFFER, SMALL_BUFF
|
||||
from manimlib.constants import DOWN, LEFT, ORIGIN, RIGHT, UP
|
||||
from manimlib.constants import PI
|
||||
from manimlib.animation.composition import AnimationGroup
|
||||
from manimlib.animation.fading import FadeIn
|
||||
from manimlib.animation.growing import GrowFromCenter
|
||||
from manimlib.animation.composition import AnimationGroup
|
||||
from manimlib.mobject.svg.tex_mobject import Tex
|
||||
from manimlib.mobject.svg.tex_mobject import SingleStringTex
|
||||
from manimlib.mobject.svg.tex_mobject import Tex
|
||||
from manimlib.mobject.svg.tex_mobject import TexText
|
||||
from manimlib.mobject.svg.text_mobject import Text
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import listify
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from typing import Iterable
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
class Brace(SingleStringTex):
|
||||
CONFIG = {
|
||||
|
@ -113,8 +118,8 @@ class BraceLabel(VMobject):
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
obj: list[VMobject] | Mobject,
|
||||
text: Iterable[str] | str,
|
||||
obj: VMobject | list[VMobject],
|
||||
text: str | Iterable[str],
|
||||
brace_direction: np.ndarray = DOWN,
|
||||
**kwargs
|
||||
) -> None:
|
||||
|
@ -124,12 +129,8 @@ class BraceLabel(VMobject):
|
|||
obj = VMobject(*obj)
|
||||
self.brace = Brace(obj, brace_direction, **kwargs)
|
||||
|
||||
if isinstance(text, Iterable):
|
||||
self.label = self.label_constructor(*text, **kwargs)
|
||||
else:
|
||||
self.label = self.label_constructor(str(text))
|
||||
if self.label_scale != 1:
|
||||
self.label.scale(self.label_scale)
|
||||
self.label = self.label_constructor(*listify(text), **kwargs)
|
||||
self.label.scale(self.label_scale)
|
||||
|
||||
self.brace.put_at_tip(self.label, buff=self.label_buff)
|
||||
self.set_submobjects([self.brace, self.label])
|
||||
|
@ -137,11 +138,11 @@ class BraceLabel(VMobject):
|
|||
def creation_anim(
|
||||
self,
|
||||
label_anim: Animation = FadeIn,
|
||||
brace_anim: Animation=GrowFromCenter
|
||||
brace_anim: Animation = GrowFromCenter
|
||||
) -> AnimationGroup:
|
||||
return AnimationGroup(brace_anim(self.brace), label_anim(self.label))
|
||||
|
||||
def shift_brace(self, obj: list[VMobject] | Mobject, **kwargs):
|
||||
def shift_brace(self, obj: VMobject | list[VMobject], **kwargs):
|
||||
if isinstance(obj, list):
|
||||
obj = VMobject(*obj)
|
||||
self.brace = Brace(obj, self.brace_direction, **kwargs)
|
||||
|
@ -158,7 +159,7 @@ class BraceLabel(VMobject):
|
|||
self.submobjects[1] = self.label
|
||||
return self
|
||||
|
||||
def change_brace_label(self, obj: list[VMobject] | Mobject, *text: str):
|
||||
def change_brace_label(self, obj: VMobject | list[VMobject], *text: str):
|
||||
self.shift_brace(obj)
|
||||
self.change_label(*text)
|
||||
return self
|
||||
|
|
|
@ -20,8 +20,8 @@ from manimlib.utils.config_ops import digest_config
|
|||
from manimlib.utils.rate_functions import linear
|
||||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.space_ops import complex_to_R3
|
||||
from manimlib.utils.space_ops import rotate_vector
|
||||
from manimlib.utils.space_ops import midpoint
|
||||
from manimlib.utils.space_ops import rotate_vector
|
||||
|
||||
|
||||
class Checkmark(TexText):
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import colour
|
||||
import itertools as it
|
||||
from typing import Iterable, Union, Sequence
|
||||
from abc import ABC, abstractmethod
|
||||
import itertools as it
|
||||
import re
|
||||
|
||||
from manimlib.constants import BLACK, WHITE
|
||||
from manimlib.mobject.svg.svg_mobject import SVGMobject
|
||||
|
@ -15,12 +13,15 @@ from manimlib.utils.color import rgb_to_hex
|
|||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import remove_list_redundancies
|
||||
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
Span = tuple[int, int]
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools as it
|
||||
import colour
|
||||
from typing import Union, Sequence
|
||||
|
||||
from manimlib.mobject.svg.labelled_string import LabelledString
|
||||
from manimlib.utils.tex_file_writing import tex_to_svg_file
|
||||
from manimlib.utils.tex_file_writing import get_tex_config
|
||||
from manimlib.utils.tex_file_writing import display_during_execution
|
||||
|
||||
from manimlib.utils.tex_file_writing import get_tex_config
|
||||
from manimlib.utils.tex_file_writing import tex_to_svg_file
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from colour import Color
|
||||
from typing import Union
|
||||
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
Span = tuple[int, int]
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import itertools as it
|
||||
from typing import Callable
|
||||
import os
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
import svgelements as se
|
||||
import numpy as np
|
||||
import svgelements as se
|
||||
|
||||
from manimlib.constants import RIGHT
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.logger import log
|
||||
from manimlib.mobject.geometry import Circle
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.geometry import Polygon
|
||||
from manimlib.mobject.geometry import Polyline
|
||||
from manimlib.mobject.geometry import Rectangle
|
||||
|
@ -21,7 +21,6 @@ from manimlib.utils.config_ops import digest_config
|
|||
from manimlib.utils.directories import get_mobject_data_dir
|
||||
from manimlib.utils.images import get_full_vector_image_path
|
||||
from manimlib.utils.iterables import hash_obj
|
||||
from manimlib.logger import log
|
||||
|
||||
|
||||
SVG_HASH_TO_MOB_MAP: dict[int, VMobject] = {}
|
||||
|
|
|
@ -1,21 +1,28 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Sequence, Union
|
||||
from functools import reduce
|
||||
import operator as op
|
||||
import colour
|
||||
import re
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK, WHITE
|
||||
from manimlib.constants import DOWN, LEFT, RIGHT, UP
|
||||
from manimlib.constants import FRAME_WIDTH
|
||||
from manimlib.constants import MED_LARGE_BUFF, MED_SMALL_BUFF, SMALL_BUFF
|
||||
from manimlib.mobject.geometry import Line
|
||||
from manimlib.mobject.svg.svg_mobject import SVGMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.tex_file_writing import tex_to_svg_file
|
||||
from manimlib.utils.tex_file_writing import get_tex_config
|
||||
from manimlib.utils.tex_file_writing import display_during_execution
|
||||
from manimlib.utils.tex_file_writing import get_tex_config
|
||||
from manimlib.utils.tex_file_writing import tex_to_svg_file
|
||||
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
SCALE_FACTOR_PER_FONT_POINT = 0.001
|
||||
|
|
|
@ -1,36 +1,38 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import itertools as it
|
||||
from pathlib import Path
|
||||
from contextlib import contextmanager
|
||||
import typing
|
||||
from typing import Iterable, Sequence, Union
|
||||
import itertools as it
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
from manimpango import MarkupUtils
|
||||
import pygments
|
||||
import pygments.formatters
|
||||
import pygments.lexers
|
||||
|
||||
from manimpango import MarkupUtils
|
||||
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.constants import DEFAULT_PIXEL_HEIGHT, DEFAULT_PIXEL_WIDTH
|
||||
from manimlib.constants import NORMAL
|
||||
from manimlib.logger import log
|
||||
from manimlib.constants import *
|
||||
from manimlib.mobject.svg.labelled_string import LabelledString
|
||||
from manimlib.utils.customization import get_customization
|
||||
from manimlib.utils.tex_file_writing import tex_hash
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.customization import get_customization
|
||||
from manimlib.utils.directories import get_downloads_dir
|
||||
from manimlib.utils.directories import get_text_dir
|
||||
from manimlib.utils.iterables import remove_list_redundancies
|
||||
|
||||
from manimlib.utils.tex_file_writing import tex_hash
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Any, Union
|
||||
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
Span = tuple[int, int]
|
||||
|
||||
|
||||
|
@ -256,7 +258,7 @@ class MarkupText(LabelledString):
|
|||
|
||||
@staticmethod
|
||||
def merge_attr_dicts(
|
||||
attr_dict_items: list[Span, str, typing.Any]
|
||||
attr_dict_items: list[Span, str, Any]
|
||||
) -> list[tuple[Span, dict[str, str]]]:
|
||||
index_seq = [0]
|
||||
attr_dict_list = [{}]
|
||||
|
@ -356,7 +358,7 @@ class MarkupText(LabelledString):
|
|||
)
|
||||
return result
|
||||
|
||||
def get_global_dict_from_config(self) -> dict[str, typing.Any]:
|
||||
def get_global_dict_from_config(self) -> dict[str, Any]:
|
||||
result = {
|
||||
"line_height": (
|
||||
(self.lsh or DEFAULT_LINE_SPACING_SCALE) + 1
|
||||
|
@ -380,7 +382,7 @@ class MarkupText(LabelledString):
|
|||
|
||||
def get_local_dicts_from_config(
|
||||
self
|
||||
) -> list[Span, dict[str, typing.Any]]:
|
||||
) -> list[Span, dict[str, Any]]:
|
||||
return [
|
||||
(span, {key: val})
|
||||
for t2x_dict, key in (
|
||||
|
|
|
@ -2,19 +2,21 @@ from __future__ import annotations
|
|||
|
||||
import math
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.mobject.types.surface import Surface
|
||||
from manimlib.constants import BLUE, BLUE_D, BLUE_E
|
||||
from manimlib.constants import IN, ORIGIN, OUT, RIGHT
|
||||
from manimlib.constants import PI, TAU
|
||||
from manimlib.mobject.types.surface import SGroup
|
||||
from manimlib.mobject.types.surface import Surface
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.mobject.geometry import Square
|
||||
from manimlib.mobject.geometry import Polygon
|
||||
from manimlib.mobject.geometry import Square
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import adjacent_pairs
|
||||
from manimlib.utils.space_ops import compass_directions
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
from manimlib.utils.space_ops import z_to_vector
|
||||
from manimlib.utils.space_ops import compass_directions
|
||||
|
||||
|
||||
class SurfaceMesh(VGroup):
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
import moderngl
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import GREY_C
|
||||
from manimlib.constants import YELLOW
|
||||
from manimlib.constants import GREY_C, YELLOW
|
||||
from manimlib.constants import ORIGIN
|
||||
from manimlib.mobject.types.point_cloud_mobject import PMobject
|
||||
from manimlib.utils.iterables import resize_preserving_order
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import numpy.typing as npt
|
||||
|
||||
|
||||
DEFAULT_DOT_RADIUS = 0.05
|
||||
DEFAULT_GLOW_DOT_RADIUS = 0.2
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import DL, DR, UL, UR
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.utils.bezier import inverse_interpolate
|
||||
from manimlib.utils.images import get_full_raster_image_path
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Sequence, Union
|
||||
|
||||
import colour
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.constants import ORIGIN
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.utils.color import color_gradient
|
||||
from manimlib.utils.color import color_to_rgba
|
||||
from manimlib.utils.iterables import resize_with_interpolation
|
||||
from manimlib.utils.iterables import resize_array
|
||||
from manimlib.utils.iterables import resize_with_interpolation
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class PMobject(Mobject):
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Callable
|
||||
|
||||
import moderngl
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import GREY
|
||||
from manimlib.constants import OUT
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
from manimlib.utils.bezier import interpolate
|
||||
|
@ -17,6 +15,10 @@ from manimlib.utils.space_ops import normalize_along_axis
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.camera.camera import Camera
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import operator as op
|
||||
from functools import reduce
|
||||
from functools import wraps
|
||||
import itertools as it
|
||||
from functools import reduce, wraps
|
||||
from typing import Iterable, Sequence, Callable, Union
|
||||
import operator as op
|
||||
|
||||
import colour
|
||||
import moderngl
|
||||
import numpy.typing as npt
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK, WHITE
|
||||
from manimlib.constants import DEFAULT_STROKE_WIDTH
|
||||
from manimlib.constants import DEGREES
|
||||
from manimlib.constants import JOINT_TYPE_MAP
|
||||
from manimlib.constants import ORIGIN, OUT, UP
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.mobject import Point
|
||||
from manimlib.utils.bezier import bezier
|
||||
from manimlib.utils.bezier import get_smooth_quadratic_bezier_handle_points
|
||||
from manimlib.utils.bezier import get_smooth_cubic_bezier_handle_points
|
||||
from manimlib.utils.bezier import get_quadratic_approximation_of_cubic
|
||||
from manimlib.utils.bezier import get_smooth_cubic_bezier_handle_points
|
||||
from manimlib.utils.bezier import get_smooth_quadratic_bezier_handle_points
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.bezier import inverse_interpolate
|
||||
from manimlib.utils.bezier import integer_interpolate
|
||||
from manimlib.utils.bezier import partial_quadratic_bezier_points
|
||||
from manimlib.utils.color import rgb_to_hex
|
||||
from manimlib.utils.iterables import listify
|
||||
from manimlib.utils.iterables import make_even
|
||||
from manimlib.utils.iterables import resize_array
|
||||
from manimlib.utils.iterables import resize_with_interpolation
|
||||
from manimlib.utils.iterables import listify
|
||||
from manimlib.utils.space_ops import angle_between_vectors
|
||||
from manimlib.utils.space_ops import cross2d
|
||||
from manimlib.utils.space_ops import earclip_triangulation
|
||||
|
@ -33,8 +36,15 @@ from manimlib.utils.space_ops import get_unit_normal
|
|||
from manimlib.utils.space_ops import z_to_vector
|
||||
from manimlib.shader_wrapper import ShaderWrapper
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
ManimColor = Union[str, colour.Color, Sequence[float]]
|
||||
if TYPE_CHECKING:
|
||||
from colour import Color
|
||||
from typing import Callable, Iterable, Sequence, Union
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
class VMobject(Mobject):
|
||||
|
@ -130,8 +140,8 @@ class VMobject(Mobject):
|
|||
|
||||
def set_fill(
|
||||
self,
|
||||
color: ManimColor | None = None,
|
||||
opacity: float | None = None,
|
||||
color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
opacity: float | Iterable[float] | None = None,
|
||||
recurse: bool = True
|
||||
):
|
||||
self.set_rgba_array_by_color(color, opacity, 'fill_rgba', recurse)
|
||||
|
@ -139,9 +149,9 @@ class VMobject(Mobject):
|
|||
|
||||
def set_stroke(
|
||||
self,
|
||||
color: ManimColor | None = None,
|
||||
width: float | npt.ArrayLike | None = None,
|
||||
opacity: float | None = None,
|
||||
color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
width: float | Iterable[float] | None = None,
|
||||
opacity: float | Iterable[float] | None = None,
|
||||
background: bool | None = None,
|
||||
recurse: bool = True
|
||||
):
|
||||
|
@ -162,8 +172,8 @@ class VMobject(Mobject):
|
|||
|
||||
def set_backstroke(
|
||||
self,
|
||||
color: ManimColor = BLACK,
|
||||
width: float | npt.ArrayLike = 3,
|
||||
color: ManimColor | Iterable[ManimColor] = BLACK,
|
||||
width: float | Iterable[float] = 3,
|
||||
background: bool = True
|
||||
):
|
||||
self.set_stroke(color, width, background=background)
|
||||
|
@ -177,13 +187,13 @@ class VMobject(Mobject):
|
|||
|
||||
def set_style(
|
||||
self,
|
||||
fill_color: ManimColor | None = None,
|
||||
fill_opacity: float | None = None,
|
||||
fill_color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
fill_opacity: float | Iterable[float] | None = None,
|
||||
fill_rgba: npt.ArrayLike | None = None,
|
||||
stroke_color: ManimColor | None = None,
|
||||
stroke_opacity: float | None = None,
|
||||
stroke_color: ManimColor | Iterable[ManimColor] | None = None,
|
||||
stroke_opacity: float | Iterable[float] | None = None,
|
||||
stroke_rgba: npt.ArrayLike | None = None,
|
||||
stroke_width: float | npt.ArrayLike | None = None,
|
||||
stroke_width: float | Iterable[float] | None = None,
|
||||
stroke_background: bool = True,
|
||||
reflectiveness: float | None = None,
|
||||
gloss: float | None = None,
|
||||
|
@ -247,12 +257,21 @@ class VMobject(Mobject):
|
|||
sm1.match_style(sm2)
|
||||
return self
|
||||
|
||||
def set_color(self, color: ManimColor, recurse: bool = True):
|
||||
self.set_fill(color, recurse=recurse)
|
||||
self.set_stroke(color, recurse=recurse)
|
||||
def set_color(
|
||||
self,
|
||||
color: ManimColor | Iterable[ManimColor] | None,
|
||||
opacity: float | Iterable[float] | None = None,
|
||||
recurse: bool = True
|
||||
):
|
||||
self.set_fill(color, opacity=opacity, recurse=recurse)
|
||||
self.set_stroke(color, opacity=opacity, recurse=recurse)
|
||||
return self
|
||||
|
||||
def set_opacity(self, opacity: float, recurse: bool = True):
|
||||
def set_opacity(
|
||||
self,
|
||||
opacity: float | Iterable[float] | None,
|
||||
recurse: bool = True
|
||||
):
|
||||
self.set_fill(opacity=opacity, recurse=recurse)
|
||||
self.set_stroke(opacity=opacity, recurse=recurse)
|
||||
return self
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools as it
|
||||
import random
|
||||
from typing import Sequence, TypeVar, Callable, Iterable
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.animation.composition import AnimationGroup
|
||||
from manimlib.animation.indication import VShowPassingFlash
|
||||
from manimlib.mobject.geometry import Arrow
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||
from manimlib.utils.bezier import inverse_interpolate
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.bezier import inverse_interpolate
|
||||
from manimlib.utils.color import get_colormap_list
|
||||
from manimlib.utils.config_ops import merge_dicts_recursively
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.config_ops import merge_dicts_recursively
|
||||
from manimlib.utils.rate_functions import linear
|
||||
from manimlib.utils.simple_functions import sigmoid
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
|
@ -25,8 +23,13 @@ from manimlib.utils.space_ops import get_norm
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from typing import Callable, Iterable, Sequence, TypeVar
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
from manimlib.mobject.coordinate_systems import CoordinateSystem
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
|
@ -299,7 +302,7 @@ class AnimatedStreamLines(VGroup):
|
|||
**self.line_anim_config,
|
||||
)
|
||||
line.anim.begin()
|
||||
line.time = -self.lag_range * random.random()
|
||||
line.time = -self.lag_range * np.random.random()
|
||||
self.add(line.anim.mobject)
|
||||
|
||||
self.add_updater(lambda m, dt: m.update(dt))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from functools import reduce
|
||||
import random
|
||||
|
||||
from manimlib.constants import *
|
||||
# from manimlib.for_3b1b_videos.pi_creature import PiCreature
|
||||
|
|
|
@ -2,10 +2,11 @@ from manimlib.animation.animation import Animation
|
|||
from manimlib.animation.transform import MoveToTarget
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.animation.update import UpdateFromFunc
|
||||
from manimlib.constants import *
|
||||
from manimlib.scene.scene import Scene
|
||||
from manimlib.constants import DOWN, RIGHT
|
||||
from manimlib.constants import MED_LARGE_BUFF, SMALL_BUFF
|
||||
from manimlib.mobject.probability import SampleSpace
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
class SampleSpaceScene(Scene):
|
||||
|
|
|
@ -1,35 +1,36 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import random
|
||||
import inspect
|
||||
import platform
|
||||
import itertools as it
|
||||
from functools import wraps
|
||||
from typing import Iterable, Callable
|
||||
import inspect
|
||||
import itertools as it
|
||||
import platform
|
||||
import random
|
||||
import time
|
||||
|
||||
from tqdm import tqdm as ProgressDisplay
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from tqdm import tqdm as ProgressDisplay
|
||||
|
||||
from manimlib.animation.animation import prepare_animation
|
||||
from manimlib.animation.transform import MoveToTarget
|
||||
from manimlib.camera.camera import Camera
|
||||
from manimlib.constants import DEFAULT_WAIT_TIME
|
||||
from manimlib.event_handler import EVENT_DISPATCHER
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
from manimlib.logger import log
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.mobject.mobject import Point
|
||||
from manimlib.scene.scene_file_writer import SceneFileWriter
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.family_ops import extract_mobject_family_members
|
||||
from manimlib.utils.family_ops import restructure_list_to_exclude_certain_family_members
|
||||
from manimlib.event_handler.event_type import EventType
|
||||
from manimlib.event_handler import EVENT_DISPATCHER
|
||||
from manimlib.logger import log
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable
|
||||
|
||||
from PIL.Image import Image
|
||||
|
||||
from manimlib.animation.animation import Animation
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess as sp
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
from pydub import AudioSegment
|
||||
from tqdm import tqdm as ProgressDisplay
|
||||
|
||||
from manimlib.constants import FFMPEG_BIN
|
||||
from manimlib.logger import log
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.file_ops import guarantee_existence
|
||||
from manimlib.utils.file_ops import add_extension_if_not_present
|
||||
from manimlib.utils.file_ops import get_sorted_integer_files
|
||||
from manimlib.utils.file_ops import guarantee_existence
|
||||
from manimlib.utils.sounds import get_full_sound_file_path
|
||||
from manimlib.logger import log
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from manimlib.scene.scene import Scene
|
||||
from manimlib.camera.camera import Camera
|
||||
from PIL.Image import Image
|
||||
|
||||
from manimlib.camera.camera import Camera
|
||||
from manimlib.scene.scene import Scene
|
||||
|
||||
|
||||
class SceneFileWriter(object):
|
||||
CONFIG = {
|
||||
|
|
|
@ -8,7 +8,10 @@ from manimlib.animation.growing import GrowArrow
|
|||
from manimlib.animation.transform import ApplyFunction
|
||||
from manimlib.animation.transform import ApplyPointwiseFunction
|
||||
from manimlib.animation.transform import Transform
|
||||
from manimlib.constants import *
|
||||
from manimlib.constants import BLACK, BLUE_D, GREEN_C, RED_C, GREY, WHITE, YELLOW
|
||||
from manimlib.constants import DL, DOWN, ORIGIN, RIGHT, UP
|
||||
from manimlib.constants import FRAME_WIDTH, FRAME_X_RADIUS, FRAME_Y_RADIUS
|
||||
from manimlib.constants import SMALL_BUFF
|
||||
from manimlib.mobject.coordinate_systems import Axes
|
||||
from manimlib.mobject.coordinate_systems import NumberPlane
|
||||
from manimlib.mobject.geometry import Arrow
|
||||
|
@ -30,6 +33,7 @@ from manimlib.utils.rate_functions import rush_into
|
|||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
|
||||
|
||||
X_COLOR = GREEN_C
|
||||
Y_COLOR = RED_C
|
||||
Z_COLOR = BLUE_D
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import os
|
||||
import re
|
||||
import copy
|
||||
from typing import Iterable
|
||||
|
||||
import moderngl
|
||||
import numpy as np
|
||||
|
@ -11,6 +10,12 @@ import numpy as np
|
|||
from manimlib.utils.directories import get_shader_dir
|
||||
from manimlib.utils.file_ops import find_file
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable
|
||||
|
||||
|
||||
# Mobjects that should be rendered with
|
||||
# the same shader will be organized and
|
||||
# clumped together based on keeping track
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Callable, TypeVar, Sequence
|
||||
|
||||
from scipy import linalg
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from scipy import linalg
|
||||
|
||||
from manimlib.utils.simple_functions import choose
|
||||
from manimlib.utils.space_ops import find_intersection
|
||||
from manimlib.utils.space_ops import cross2d
|
||||
from manimlib.utils.space_ops import midpoint
|
||||
from manimlib.logger import log
|
||||
from manimlib.utils.simple_functions import choose
|
||||
from manimlib.utils.space_ops import cross2d
|
||||
from manimlib.utils.space_ops import find_intersection
|
||||
from manimlib.utils.space_ops import midpoint
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable, Sequence, TypeVar
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
CLOSED_THRESHOLD = 0.001
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
def bezier(
|
||||
points: Iterable[float | np.ndarray]
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Union
|
||||
|
||||
from colour import Color
|
||||
from colour import hex2rgb
|
||||
from colour import rgb2hex
|
||||
import numpy as np
|
||||
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.constants import COLORMAP_3B1B
|
||||
from manimlib.constants import WHITE
|
||||
from manimlib.utils.bezier import interpolate
|
||||
from manimlib.utils.iterables import resize_with_interpolation
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable, Union
|
||||
|
||||
ManimColor = Union[str, Color]
|
||||
|
||||
|
||||
def color_to_rgb(color: ManimColor) -> np.ndarray:
|
||||
|
|
|
@ -4,6 +4,7 @@ import tempfile
|
|||
from manimlib.config import get_custom_config
|
||||
from manimlib.config import get_manim_dir
|
||||
|
||||
|
||||
CUSTOMIZATION = {}
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import numpy as np
|
||||
from typing import Callable
|
||||
import time
|
||||
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.logger import log
|
||||
from manimlib.mobject.numbers import Integer
|
||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||
from manimlib.logger import log
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
import os
|
||||
|
||||
from manimlib.utils.file_ops import guarantee_existence
|
||||
from manimlib.utils.customization import get_customization
|
||||
from manimlib.utils.file_ops import guarantee_existence
|
||||
|
||||
|
||||
def get_directories() -> dict[str, str]:
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import itertools as it
|
||||
from typing import Iterable
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable
|
||||
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Iterable
|
||||
|
||||
import numpy as np
|
||||
import validators
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Iterable
|
||||
|
||||
|
||||
def add_extension_if_not_present(file_name: str, extension: str) -> str:
|
||||
# This could conceivably be smarter about handling existing differing extensions
|
||||
|
|
|
@ -2,9 +2,9 @@ import numpy as np
|
|||
from PIL import Image
|
||||
from typing import Iterable
|
||||
|
||||
from manimlib.utils.file_ops import find_file
|
||||
from manimlib.utils.directories import get_raster_image_dir
|
||||
from manimlib.utils.directories import get_vector_image_dir
|
||||
from manimlib.utils.file_ops import find_file
|
||||
|
||||
|
||||
def get_full_raster_image_path(image_file_name: str) -> str:
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import inspect
|
||||
import os
|
||||
import yaml
|
||||
import inspect
|
||||
import importlib
|
||||
from typing import Any
|
||||
|
||||
from rich import box
|
||||
from rich.console import Console
|
||||
from rich.prompt import Confirm
|
||||
from rich.prompt import Prompt
|
||||
from rich.rule import Rule
|
||||
from rich.table import Table
|
||||
from rich.console import Console
|
||||
from rich.prompt import Prompt, Confirm
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
|
||||
def get_manim_dir() -> str:
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Iterable, Sequence, TypeVar
|
||||
|
||||
import numpy as np
|
||||
|
||||
T = TypeVar("T")
|
||||
S = TypeVar("S")
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable, Sequence, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
S = TypeVar("S")
|
||||
|
||||
|
||||
def remove_list_redundancies(l: Iterable[T]) -> list[T]:
|
||||
|
|
|
@ -8,6 +8,7 @@ from manimlib.utils.bezier import interpolate
|
|||
from manimlib.utils.space_ops import get_norm
|
||||
from manimlib.utils.space_ops import rotation_matrix_transpose
|
||||
|
||||
|
||||
STRAIGHT_PATH_THRESHOLD = 0.01
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from typing import Callable
|
||||
|
||||
import numpy as np
|
||||
from typing import Callable
|
||||
|
||||
from manimlib.utils.bezier import bezier
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import inspect
|
||||
import numpy as np
|
||||
import math
|
||||
from functools import lru_cache
|
||||
import inspect
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def sigmoid(x):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from manimlib.utils.file_ops import find_file
|
||||
from manimlib.utils.directories import get_sound_dir
|
||||
from manimlib.utils.file_ops import find_file
|
||||
|
||||
|
||||
def get_full_sound_file_path(sound_file_name) -> str:
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from functools import reduce
|
||||
import math
|
||||
import operator as op
|
||||
from functools import reduce
|
||||
from typing import Callable, Iterable, Sequence
|
||||
import platform
|
||||
|
||||
import numpy as np
|
||||
import numpy.typing as npt
|
||||
from mapbox_earcut import triangulate_float32 as earcut
|
||||
import numpy as np
|
||||
from scipy.spatial.transform import Rotation
|
||||
from tqdm import tqdm as ProgressDisplay
|
||||
|
||||
from manimlib.constants import RIGHT
|
||||
from manimlib.constants import DOWN
|
||||
from manimlib.constants import OUT
|
||||
from manimlib.constants import PI
|
||||
from manimlib.constants import TAU
|
||||
from manimlib.constants import DOWN, OUT, RIGHT
|
||||
from manimlib.constants import PI, TAU
|
||||
from manimlib.utils.iterables import adjacent_pairs
|
||||
from manimlib.utils.simple_functions import clip
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Callable, Iterable, Sequence
|
||||
|
||||
import numpy.typing as npt
|
||||
|
||||
|
||||
def cross(v1: np.ndarray, v2: np.ndarray) -> list[np.ndarray]:
|
||||
return [
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import sys
|
||||
import os
|
||||
import hashlib
|
||||
from contextlib import contextmanager
|
||||
import hashlib
|
||||
import os
|
||||
import sys
|
||||
|
||||
from manimlib.utils.directories import get_tex_dir
|
||||
from manimlib.config import get_manim_dir
|
||||
from manimlib.config import get_custom_config
|
||||
from manimlib.config import get_manim_dir
|
||||
from manimlib.logger import log
|
||||
from manimlib.utils.directories import get_tex_dir
|
||||
|
||||
|
||||
SAVED_TEX_CONFIG = {}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
|
||||
import moderngl_window as mglw
|
||||
from moderngl_window.context.pyglet.window import Window as PygletWindow
|
||||
from moderngl_window.timers.clock import Timer
|
||||
|
|
Loading…
Add table
Reference in a new issue