Essa página é uma cópia da original publicada em http://users.senet.com.au/%7Ekerrb/fractals/howto/fracpub.html, uma vez que a página não está mais disponível.

MAKING AND PUBLISHING ANIMATED FRACTALS ON THE INTERNET

-- Bill Kerr, January 1998, email: kerrb at senet.com.au

Fractals are beautiful and interesting mathematical objects in their own right.

As well as that they provide one entry point to an understanding or appreciation of the extremely powerful concept of recursion. From an educational viewpoint this should be the main objective. However, the pathway of admire and / or produce first and then understand later is quite acceptable and for space reasons is the one followed in this article.

It has always been possibly to make fractals with programming languages that support recursion. Of late because of software development it has become relatively easy to publish them on the Internet. This article describes one way to do this using the programming language Logo and directs you to this web site where you can see some beautiful fractal designs:- http://www.senet.com.au/~kerrb/

A new twist is to produce animated fractal images by tweaking the code, capturing a series of snapshots and then stringing them together into an animated sequence. This is how I produced a fractal fern which appears to move from side to side, as though in a breeze, described below.

Steps:-

1. Download MSWLogo from George Mills site (its free) from http://www.softronix.com/

2. You will need logo code that produces a fractal image. One useful reference here is The Fractal Umbrella (published by AAMT). Here is the code that produces a fractal fern:-

fractal fernto fern3 :size
if :size < 5 [stop]
fd :size / 20
lt 80 fern3 :size * .3
rt 82 fd :size / 20
rt 80 fern3 :size * .3
lt 78 fern3 :size * .9
lt 2 bk :size / 20
lt 2 bk :size / 20
end

This code is the kernel you need to get started. There are lots of tricks you will need to learn along the way before your design merits publication on the web (eg. use of colour for realism, generating transparent backgrounds using a graphics package etc. ). However, if you want to become a producer rather than just an admirer of fractals then the important thing is to make a start and then ask for help as you go along. A good place to ask for help is the newsgroup comp.lang.logo. I have been delighted and amazed by the helpfulness of the members of this newsgroup.

3. Tweak the code to produce variation in the appearance of the fern:-

fractal fernto fern4 :size
if :size < 5 [stop]
fd :size / 20
lt 80 fern4 :size * .3
rt 84 fd :size / 20
rt 80 fern4 :size * .3
lt 76 fern4 :size * .9
lt 4 bk :size / 20
lt 4 bk :size / 20
end

I have changed the angle of the right turn from 82 degrees to 84 degrees, so the fern bends further to the right than before. It is necessary to make some compensatory changes in the other angles as well.

By further tweaking the code I ended up with 5 different images of the fern as follows:-

fractal fern fractal fern fractal fern fractal fern fractal fern

fern1.gif fern2.gif fern3.gif fern4.gif fern5.gif

4. We now want to save our image as a *.gif file since this is a standard graphics format for Internet publishing.

George Mills (the developer of MSWLogo) has recently incorporated GIFSAVE into his software, which not only allows you to save your Logo generated graphic as a *.gif file but also enables you to generate a series of graphics and save them as an animated gif, all within the MSWLogo program! Look up gifsave in MSWLogo Help for all the details.

If you have 5 procedures, fern1, fern2 ... fern5 corresponding to the 5 images above then here is how to turn them into a single animated image, all done within MSWLogo:-

to fern_final
initial
ferngif 1
end

to initial
setactivearea [-50 -10 70 100]
make "append "False ; Flag to indicate we do not append the first frame
end

to ferngif_up :no
if :no > 5 [ferngif_down 4 stop]
cs ht
run se word "fern :no 100
(gifsave "fern.gif 100 :append 0) ; Save a frame (standard delay and loop forever)
make "append "True
ferngif_up :no + 1
end

to ferngif_down :no
if :no = 1 [stop]
cs ht
run se word "fern :no 100
(gifsave "fern.gif 100 :append 0) ; Save a frame (standard delay and loop forever)
ferngif_down :no - 1
end

Now open the file fern.gif with your Internet Browser (e.g. Netscape or Internet Explorer). This will be an animated fractal fern blowing in the wind! It will look much better with a transparent background. You will need graphics software such as the latest version of PaintShopPro to make this addition. A public domain copy is available from http://www.jasc.com

5. Finally, incorporate into HTML file and publish!

< HTML >
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<P><IMG SRC="fern.gif" height=100 width=100 HSPACE=10 VSPACE=3 BORDER=0 ALT="fractal fern" align=left><br> Animated <br>fractal <br>fern</P></CENTER>
</BODY>
</HTML>
</P>

Acknowledgements:

George Mills for his brilliant software, MSWLogo (and unbelievably its FREE !!) http://www.softronix.com/

Olga Tuzova for being the first to explain to the Logo newsgroup how animated logo images could be published on the Internet. Visit Olga's web site for some other excellent examples of animated images produced from logo programming (not just fractals either): http://www.ort.spb.ru/personal/tch/tuzova/logo/animat.htm

Yehuda Katz, inspirational Logo teacher and fractal fanatic. Check out his recursive graphics site at http://www.beitberl.ac.il/~shafee/hpage.html (Yehuda's designs are recursive but not animated).

Erich Neuwirth for suggesting more elegant logo code than in the original draft. This is recommended for experienced logo users. For more details of Erich's code click here!!

References:

Beaumont, Bill and Scott, Paul (1994) The Fractal Umbrella , Australian Association of Mathematics Teachers

Neuwirth, Erich. Logo at the Movies, http://www.eurologo.org/papers/logomov.html Erich's explanation was written before the new gifsave features in MSWLogo came out but is still a very good read, with additional ideas not contained in this article.