A community-maintained Python framework for creating mathematical animations.
Fixed `.gif` related issues (#2494)
Kiran-Raj-Devdf8cefe984dc
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.pyindex a370eeba3..dad30fdbb 100644--- a/manim/scene/scene_file_writer.py+++ b/manim/scene/scene_file_writer.py@@ -144,7 +144,12 @@ class SceneFileWriter:if is_gif_format():self.gif_file_path = os.path.join(movie_dir,- add_extension_if_not_present(self.output_name, GIF_FILE_EXTENSION),+ add_version_before_extension(+ add_extension_if_not_present(+ self.output_name,+ GIF_FILE_EXTENSION,+ ),+ ),)self.partial_movie_directory = guarantee_existence(@@ -606,7 +611,7 @@ class SceneFileWriter:# determine output pathmovie_file_path = self.movie_file_pathif is_gif_format() and not config["output_file"]:- movie_file_path = str(add_version_before_extension(self.gif_file_path))+ movie_file_path = self.gif_file_pathlogger.info("Combining to Movie file.")self.combine_files(partial_movie_files,diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.pyindex bb65b6083..b30a8cd1d 100644--- a/manim/utils/file_ops.py+++ b/manim/utils/file_ops.py@@ -178,7 +178,10 @@ def open_file(file_path, in_browser=False):commands = ["cygstart"]file_path = file_path if not in_browser else os.path.dirname(file_path)elif current_os == "Darwin":- commands = ["open"] if not in_browser else ["open", "-R"]+ if is_gif_format():+ commands = ["ffplay", "-loglevel", config["ffmpeg_loglevel"].lower()]+ else:+ commands = ["open"] if not in_browser else ["open", "-R"]else:raise OSError("Unable to identify your operating system...")commands.append(file_path)