Skip to content

fix: space_out_submobjects method improved#4651

Open
GoThrones wants to merge 9 commits intoManimCommunity:mainfrom
GoThrones:fix/space-out-submobjects
Open

fix: space_out_submobjects method improved#4651
GoThrones wants to merge 9 commits intoManimCommunity:mainfrom
GoThrones:fix/space-out-submobjects

Conversation

@GoThrones
Copy link
Copy Markdown
Contributor

@GoThrones GoThrones commented Mar 23, 2026

Overview: What does this pull request change?

space_out_submobjects method was scaling the submobjects unevenly from the mobject's center. The submobjects were shifting in x, y directions simultaneously. Also, it was not working for Tex mobjects, but only for Text mobjects. This PR makes the necessary changes so that the submobjects space out only in x direction, and it works for Tex and Text both.

Motivation and Explanation: Why and how do your changes improve the library?

When this code is run:

from manim import *

class tryspacingout(Scene):
    def construct(self):
        t1 = Tex("Manim is cool").shift(1.25*UP)
        t2 = Text("Manim is awesome").shift(1.25*DOWN)
        self.play(t1.animate.space_out_submobjects(),
                  t2.animate.space_out_submobjects(factor = 3.5),
                  run_time = 3, 
                  rate_func = there_and_back
                  )

The output is:
1

But the code in this PR makes this output:

tryspacingout.mp4

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant