Bringing an Animated GIF Into Second Life

Introduction

So you’ve browsed the Internet and found the perfect animated GIF, one that you desperately want on a texture in your SL home, but how do you bring it into Second Life and animate it?

This article will explain how to convert an animated GIF into a format that can be played within Second Life, then show you how to script an object to display the texture on your prims.

Converting the GIF

The first step in getting an animated GIF into Second Life is to remember that you can’t upload a GIF into Second Life, let alone an animated one. Instead we must first convert the animated GIF into a different format.

Here’s our sample image:

jump.gif

Nice and annoying, but not in an acceptable format.

To convert this GIF, we use a tool called BitStrip. BitStrip will convert an animated GIF into a BMP, splitting it into frames places end to end.

BitStrip is seemingly abandonware as the author has removed his site from the net and broken all download links, so I am providing a mirror here for your GIF conversion needs:

bitstripv1_10.zip

The UI itself is very simple:

bitstrip.png

Start by clicking the Browse button and choosing the file you wish to convert, then click the vertical button to bring up a preview of the filmstrip formatted vertically. You can close the preview, then click the Save button to save to a bitmap file.

Your bitmap file should look something like this:

jump.bmp

In this format we are now able to load the filmstrip into Second Life using Ctrl + U and a few Lindens. The pink background in this example comes from the transparent background of the original image, you can edit the filmstrip to change the color when converting transparent GIFs.

Creating and Animating the Texture

Once your image is uploaded into Second Life, create a prim to display it on and drag the texture onto one of the faces.

With the texture in place, we can then use the llSetTextureAnim() function (see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetTextureAnim):

  1. default
  2. {
  3.     state_entry()
  4.     {
  5.         llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 1, 4, 0.0, 0.0, 4);
  6.     }
  7. }

In this example, we set the texture to animate by looping through the individual frames in our filmstrip image. We set the animation on all sides of the prim by using the ALL_SIDES constant (you can get a specific side by following these instructions). Next we specify how many horizontal frames there are, in our case one frame, and how many vertical frames there are, in our case four frames. The next two values are the start frame and frame count, by setting both to zero we start at the first frame and play all frames. Finally we see the number of frames per second to play, which I have set to four to allow the animation to play once per second.

Conclusion

As you can see, the use of a simple tool and a simple script makes it easy to bring an animated GIF into Second Life for all to enjoy!

snapshot_001.bmp

4 Responses to “Bringing an Animated GIF Into Second Life”

  1. Coyote Says:

    I was recently fiddling with llSetTextureAnim, and found some good tools for working on this sort of thing in Gimp 2.4. One is of course GAP, Gimp Animation Package, which lets you tinker with layers as animation frames. Then a very handy Gimp script for creating an arrayed animation texture of this sort is Saul Goode’s mosaicize: http://flashingtwelve.brickfilms.com/GIMP/Scripts/mozaicize.scm .. It’s also worth having a look at Movies Extractor Scout, an inexpensive tool (w/ free demo) for cutting frame images from Flash movies.

  2. squiz Clifton Says:

    Or you can go here http://www.peregrinesalon.com/anim/
    it converts the image and even makes you a custom script for it.

  3. Mike Crosley Says:

    You are AWESOME! I’ve seen some animated GIF’s, particularly around Xmas time, that I wanted to do this exact thing with, and I went through a difficult and laborious task of breaking it into so many frames a much harder way, that I just felt it wasn’t worth it. This way, it couldn’t be easier! Many thanks!

  4. Adasyd Says:

    Got a friend to make this, way better than anything I’ve seen out there.

    http://nivardus.com/sl/slanim.html

Leave a Reply