Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Recipe: Create a Squeak movie
Last updated at 8:33 am UTC on 7 May 2004

Squeak includes a MoviePlayerMorph which can play squeak movies with the extension .movie.
Note that these movies have nothing to do with Quicktime movies.

A squeak movie a series of uncompressed binary Squeak forms. Look at MoviePlayerMorph's class comment to see an example, which boils down to Form>>#writeOnMovie:.



To rebuild the movie from the pixar gif:



1. Download the animated gif (right click on image ... save picture)



The following link is broken. Can we use another animated gif?



2. Use a tool (for instance AnimationShop from PaintShop5) to save the frames as bitmaps. The animated gif has 12 frames, so we name the bitmaps like the following: luxo003.bmp, luxo006.bmp, .... ,luxo036.bmp
You can also download a zip file with the frames.

3. Evaluate the following code in squeak:


=| ps zps f32 out ff |
out _ FileStream newFileNamed: 'luxo.movie'.
out binary.
ff _ Form extent: 64@64 depth: 32.
#(22 64 64 32 12 100000) , (7 to: 32)
        do: [:i | out nextInt32Put: i].
       
3 to: 36 by: 3 do: [
        :i | ps _ i printString. zps _ ps padded: #left to: 3 with: $0.
        f32 _ Form fromFileNamed: 'luxo' , zps , '.bmp'.
        f32 displayOn: ff at: 0@0.  "Convert down to 16 bits"
        ff display; writeOnMovie: out].
        out close.


The Array contains the movie header with the following informations:



22 = ?
64 = x-size of bitmaps
64 = y-size of bitmaps
32 = depth of bitmaps
12 = number of frames
100000 = ?
7 ... 32 = ?

4. Load the movie file into squeak.