MCPcopy
hub / github.com/ManimCommunity/manim / replace

Method replace

manim/mobject/mobject.py:1895–1910  ·  view source on GitHub ↗
(
        self, mobject: Mobject, dim_to_match: int = 0, stretch: bool = False
    )

Source from the content-addressed store, hash-verified

1893 return self
1894
1895 def replace(
1896 self, mobject: Mobject, dim_to_match: int = 0, stretch: bool = False
1897 ) -> Self:
1898 if not mobject.get_num_points() and not mobject.submobjects:
1899 raise Warning("Attempting to replace mobject with no points")
1900 if stretch:
1901 self.stretch_to_fit_width(mobject.width)
1902 self.stretch_to_fit_height(mobject.height)
1903 else:
1904 self.rescale_to_fit(
1905 mobject.length_over_dim(dim_to_match),
1906 dim_to_match,
1907 stretch=False,
1908 )
1909 self.shift(mobject.get_center() - self.get_center())
1910 return self
1911
1912 def surround(
1913 self,

Callers 1

surroundMethod · 0.95

Calls 7

stretch_to_fit_widthMethod · 0.95
stretch_to_fit_heightMethod · 0.95
rescale_to_fitMethod · 0.95
shiftMethod · 0.95
get_centerMethod · 0.95
get_num_pointsMethod · 0.45
length_over_dimMethod · 0.45

Tested by

no test coverage detected