如何在Godot 4中播放GIF?

huangapple go评论62阅读模式
英文:

How do I play a gif in godot4?

问题

我想在我的Godot 4项目中播放一个简单的gif。

假设我有一个名为video.gif的gif文件。我如何使用GDscript播放它?哪个组件可以播放gif?如果我不能播放gif,我能播放视频文件吗?如果我也不能这样做,我如何在Godot 4中显示视频/gif?

英文:

I want to play a simple gif in my godot4 project.

Let's say that I have a gif file named video.gif. How do I play it using GDscript? Which component would play a gif? If I can't play a gif, can I play a video file? If I also can't do that, how can I display a video/gif in godot4?

答案1

得分: 2

Godot在默认情况下不支持gif。通过插件可能可以实现此功能,但是我不知道有关gif的插件。

如果可以使用视频,我建议使用Godot支持的OGV格式。在Godot 4中,您可以使用VideoStreamPlayer 播放它,或者在Godot 3中使用VideoPlayerGodot 3也支持WEBM视频,但存在问题,这导致它在Godot 4中被移除。

详细信息请参阅播放视频(Godot 4Godot 3)。

英文:

Out of the box Godot does not have support for gif. It might be possible to add this functionality via plugins, however I'm not aware of one for gif.

If you can use video, then I recommend the OGV format, which Godot supports, of course. You can play it with the VideoStreamPlayer in Godot 4, or the VideoPlayer in Godot 3. Godot 3 also had support for WEBM video, however it was problematic, which let to it being removed for Godot 4.

See Playing Videos (Godot 4, Godot 3) for details.

huangapple
  • 本文由 发表于 2023年5月17日 14:40:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76269188.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定