From Test-Scratch-Wiki

Translate: - English - Türkçe - 中文 
Warning Warning: 華麗的GIF(快速切換非常不同的幀)可能會刺激性,甚至會導致光敏性癲癇發作。最好不要在用戶圖標,簽名或縮略圖中使用它們。如果某個項目正在使用,則最好在「注意」和「開場字幕」中發出警告。
Caution (2).png Caution: GIF可能會滯後。通常建議在項目中預加載GIF,或使用幀數較少的緩慢移動的GIF。大GIF應該壓縮。
An example of one of the more popular animated GIF icons for User Icons

動畫GIF 是帶有多個幀的GIF文件 可以按順序播放,製作動畫。動畫GIF經常用作配置文件圖片和簽名。

由於它與其他文件類型不同,它們在網際網路上非常流行,但是,它們經常因過度使用,滯後和煩惱而受到批評,尤其是對於華麗的使用者而言。

它們在網際網路上很受歡迎,因為它的動畫與其他文件類型不同,但經常被批評為過度使用、延遲和煩惱,尤其是華而不實的文件。

如何將動畫GIF導入Scratch

下面列出了如何導入動畫 GIF的步驟:

  1. 下載動畫GIF.
  2. Click on the import button on the sprite's costumes and select the file.
  3. The Costumes Pane should create a new costume for every frame of the animation (This may take a while for large *.gif files).


Caution (2).png Caution: Scratch does not take into account GIFs that have been compressed, a method in which each frame only shows the pixels changed from the previous frame causing randomly splattered frames. For example, if there was a compressed GIF of a walking sprite, the first frame would be whole. Every other frame would only show the walking sprite.[1] That is because only the walking sprite is moving or changing. To prevent this, make sure each frame contains a solid background. This can be fixed by using this script below:
next costume
stamp

Animating the GIF

Main article: Animating a Sprite


Warning Tip: Please remember to adjust the scripts shown in this tutorial as necessary to best fit a project.

The following lists steps on how to script an animation to script the animation:

  • A simple way to animate the GIF file in Scratch is to use the following script.
when gf clicked
switch costume to [1 v]
set [fps v] to [16]
forever
   next costume
   wait ((1) / (fps)) secs
  • One could just as easily swap out the "fps" (short for frames per second) variable for any arbitrary number. A higher value will increase the speed and the value "0" will cause an error. A typical frame rate for movies is 24 FPS.
  • See this script in action here.

Costumes to Animated GIFs

Just like Scratch can turn animated GIFs into costumes, some people want to be able to turn costumes into animated GIFs.[citation needed] This would be very useful as people would be able to export their Scratch animation to another program. Currently, this is not a feature, but there are external and online tools that support this feature, which requires exporting the costumes (can be time-consuming).

什麼是GIF

A GIF, the acronym of a graphic interchange format, is an animating lossless format for image files that supports both animated and static images. There is no limit for how many frames there are in a gif but the longer it is, the bigger it is, and sometimes a bit laggier.

References

  1. cheddargirl. (3/7/2013). "The next frame only displays the pixels that have changed from the previous frame before it." https://scratch.mit.edu/discuss/post/71657/