Blog returned: insufficient postage.

Creating Flash Animations on Linux - part 1

Date/Time Permalink: 05/07/07 09:28:25 am
Category: Flash

It's all well and good that Adobe did get the Flash plug-in for Firefox/Linux going, but what we don't (and perhaps will never) have is an Adobe-supported way to create Flash animations on a Linux box.

So we have Open Source work-arounds, and I'll be exploring them one at a time. After all, those of us who earn our living with a Linux machine could stand to beef up our resumes, right?

Here's a package to get started with: Get the SWFTools package. Let's check out the "brute force" method first, with "PNG2SWF".

I made a series of .png images of a simple vector star in Inkscape, saving them as "star_01.png, star_02.png" etc. When starting a sequence of pictures like this, it's best to name the files with zero-indexing; if I used "star_1, start_2", then when I got to "star_10", the file system would sort 10 between 1 and 2, which isn't what we want.

Here's the pngs in a gallery in gthumb:

star images

It is also recommended that you save all the png images in their own directory.

Now, I pop open a command line, cd into that directory where the images files are, and type:

png2swf -o star.swf ./*.png

and out comes a Flash animation composed of the images. Result here.

To display it in a web page, I use this:

<object>
<param name="movie" value="star.swf" />
<param name="loop" value="true" />
<param name="quality" value="high" />
<embed src="./star_test_png/star.swf" width="100" height="100" />
</object>

...the height and width is set to the size of the original PNGs.

This is just a "slideshow" method of doing it. The same methods work for the various other tools in the SWFTools collection which can do a similar trick with .jpg, .gif, etc. Admittedly, doing your images one at a time is a pain, and you might as well be making an animated gif. This is just a start: we'll explore more sophisticated means in future installments.

Follow me on Twitter for an update every time this blog gets a post.
Stumble it Reddit this share on Facebook

suddenly the moon