3b1b / manim

Animation engine for explanatory math videos
MIT License
62.57k stars 5.8k forks source link

FadeOut and transparency #125

Open bhbr opened 6 years ago

bhbr commented 6 years ago

When fading out a composed Mobject (i. e. containing submobs), the pixels fade to black instead of the color of the mobject hidden behind it.

from helpers import *
from mobject import Mobject
from mobject.vectorized_mobject import *
from animation.animation import Animation
from animation.transform import *
from animation.simple_animations import *
from topics.geometry import *
from scene import Scene
from camera import Camera

class SampleScene(Scene):

    def construct(self):

        lines = Mobject() # VMobject()
        line1 = Line(LEFT, RIGHT)
        line2 = Line(UP, DOWN)
        lines.add(line1, line2)

        rect = Rectangle(fill_color = BLUE, fill_opacity = 1)

        self.add(lines)
        self.add(rect)

        self.wait()

        self.play(FadeOut(lines))

Result:

bildschirmfoto 2018-02-15 um 20 52 11

This does not happen in the exported PNG, and also not if lines is instantiated as a VMobject.

nikhithabhupal2000 commented 5 years ago

Actually, the lines are fading out into the background color only. Since you are "adding" the lines to the screen, they are becoming visible in the end . Just write self.wait(5) after the fadeout statement to observe that lines fadeout to background color . Hope this helps you .Knidly can you close the issue as it no longer exsists..