45
45
RendererType ,
46
46
)
47
47
from ..mobject .mobject import Group , Mobject
48
+ from ..mobject .types .vectorized_mobject import VGroup
48
49
from ..utils .paths import path_along_arc , path_along_circles
49
50
from ..utils .rate_functions import smooth , squish_rate_func
50
51
@@ -729,7 +730,10 @@ def construct(self):
729
730
def __init__ (
730
731
self , * mobjects : Mobject , path_arc : float = 90 * DEGREES , ** kwargs
731
732
) -> None :
732
- self .group = Group (* mobjects )
733
+ if len (mobjects ) == 1 and isinstance (mobjects [0 ], (Group , VGroup )):
734
+ self .group = mobjects [0 ]
735
+ else :
736
+ self .group = Group (* mobjects )
733
737
super ().__init__ (self .group , path_arc = path_arc , ** kwargs )
734
738
735
739
def create_target (self ) -> Group :
@@ -741,7 +745,21 @@ def create_target(self) -> Group:
741
745
742
746
743
747
class Swap (CyclicReplace ):
744
- pass # Renaming, more understandable for two entries
748
+ """Another name for :class:`~.CyclicReplace`, which is more understandable for two entries.
749
+
750
+ Examples
751
+ --------
752
+ .. manim :: SwapExample
753
+
754
+ class SwapExample(Scene):
755
+ def construct(self):
756
+ text_a = Text("A").move_to(LEFT)
757
+ text_b = Text("B").move_to(RIGHT)
758
+ text_group = Group(text_a, text_b)
759
+ self.play(FadeIn(text_group))
760
+ self.play(Swap(text_group))
761
+ self.wait()
762
+ """
745
763
746
764
747
765
# TODO, this may be deprecated...worth reimplementing?
0 commit comments