Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearTransformationScene in v0.17.3: Circumscribe() causes problems #3356

Open
uwezi opened this issue Sep 2, 2023 · 0 comments
Open

LinearTransformationScene in v0.17.3: Circumscribe() causes problems #3356

uwezi opened this issue Sep 2, 2023 · 0 comments

Comments

@uwezi
Copy link
Contributor

uwezi commented Sep 2, 2023

Description of bug / unexpected behavior

in the LinearTransformationScene using self.play(Circumscribe()) around a MathTex() object leaves non-VMobjetcs behind on the scene which prevent any matrix operation.

See also https://discord.com/channels/581738731934056449/1147643803956682802/1147643803956682802

Expected behavior

An animation like Circumscribe() should clean up after itself...

How to reproduce the issue

The code below reproduces the problem, aborting with

TypeError: All submobjects must be of type VMobject

Remove the comment before #self.moving_mobjects = [] and the code will execute correctly.

Code for reproducing the problem
class LinearTransformationSceneExample_02(LinearTransformationScene):
    def __init__(self):
        LinearTransformationScene.__init__(
            self,
            show_coordinates=True,
            leave_ghost_vectors=True,
            background_plane_kwargs={"x_range":[-4,4,0.5],"y_range":[-2.25,2.25,0.5],"x_length":14.22,"y_length":8},
            foreground_plane_kwargs={"x_range":[-8,8,0.5],"y_range":[-4.5,4.5,0.5],"x_length":2*14.22,"y_length":2*8}
        )

    def construct(self):
        matrix = [[1 / 2, 0], [0, -1 / 2]]
        matrix_tex = MathTex(r"\hat{S}_z = \begin{bmatrix} \frac{1}{2}\hbar & 0 \\ "
                             r"0 & -\frac{1}{2}\hbar \end{bmatrix}").to_edge(UL).add_background_rectangle()
        matrix_tex2 = MathTex(r"\theta = 2").to_edge(UR).add_background_rectangle()
        self.add_foreground_mobject(matrix_tex, matrix_tex2)

        self.add_transformable_mobject(Vector(self.background_plane.c2p(0.809, -0.5878), color=BLUE))

        self.play(Circumscribe(matrix_tex))
        #self.moving_mobjects = []

        self.apply_matrix(matrix)
        self.wait()     

System specifications

  • happens on Windows 10 and Manimator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant