manim icon indicating copy to clipboard operation
manim copied to clipboard

using `Write` `reverse=True` makes the object disappear after writing

Open M-Ali-ML opened this issue 2 years ago • 2 comments

Description of bug / unexpected behavior

If you use Write with kwarg reverse=True the animation of object, say the text, will start from right to left, which is the intended action, and it does work, however once the animation ends, the object just disappear.

Expected behavior

The object should not disappear.

How to reproduce the issue

Code for reproducing the problem
class write_text_dir_rtl(Scene):
    def construct(self):
        text = Tex("Hello World")
        self.play(Write(text, reverse=True))
        self.wait()  

Workaround

A workaround for this issue is to use self.add(text) after animating in to keep it in the frame. The code should look like this.

class write_text_dir_rtl(Scene):
    def construct(self):
        text = Tex("Hello World")
        self.play(Write(text, reverse=True))
        self.add(text)
        self.wait()

M-Ali-ML avatar Jan 26 '23 20:01 M-Ali-ML

Hi @MightyStud , your code works well! Another method is also available:

from manim import *

class write_text_dir_rtl(Scene):
    def construct(self):
        text = Tex("Hello World")
        self.play(Write(text, reverse=True, remover=False))
        self.wait()

Add remover=False and there is no need to add mobjects again.

chunribu avatar Jan 27 '23 01:01 chunribu

This should be considered for Experimental that we do not introduce similar unintuitive behavior

MrDiver avatar Dec 02 '23 13:12 MrDiver