Closed
Description
Description of bug / unexpected behavior
After adding an ImageMobject
:
- When applying
.animate.set_opacity(0.1)
, the opacity goes up from 0.0 to 0.1 instead of going down from 1.0 to 0.1. - Applying
.animate.set_opacity(0.5)
works as expected. - When applying
FadeOut
, the opacity of the image goes to 1.0 instead of 0.0. - Applying
FadeIn
works as it should: it starts with an opacity of 0.0, and it goes up to 0.5: the last opacity we set before.
Expected behavior
- When applying
.animate.set_opacity(0.1)
, the opacity should have gone down from 1.0 to 0.1. - When applying
FadeOut
, the opacity of the image should have gone down to 0.0.
How to reproduce the issue
class ImageScene(Scene):
def construct(self):
array = np.zeros((400, 400, 4), dtype=np.uint8)
array[:, :, 1] = 255 # Green
array[:, :, 3] = 255 # Opaque
image = ImageMobject(array)
self.add(image)
self.play(image.animate.set_opacity(0.1))
self.play(image.animate.set_opacity(0.5))
self.play(FadeOut(image))
self.play(FadeIn(image))
Additional media files
Current version (with bug):
ImageScene.mp4
Without this bug, it should look like this instead (I rendered this video on an earlier version of Manim):
ImageScene.mp4
Additional comments
This bug is recent. I switched to the branch for my PR #3742, last updated in July, and the error was not present. I haven't yet found the cause of this. I looked at the fading.py
, transform.py
, animation.py
and image_mobject.py
, but I didn't find any relevant change: most of them were added typehints.
NOTE: I had to change a np.float_
to np.float64
in manim.utils.iterables
and convert the config.frame_rate
float to a Fraction
in manim.scene.scene_file_writer
in order to be able to render the scene in that older branch.
Metadata
Metadata
Assignees
Labels
No labels