538d5d3ef51f516297d7d58512f389435b54f5c3
[swftools.git] / doc / fileformat.sc
1 # File header
2 # -----------
3
4 .flash bbox=200x200 version=6 fps=50 name="spec.swf" compress
5
6 # bbox=200x200         : set bounding box to 200x200
7 # bbox=200x200:100:100 : set bounding box to (100,100)-(300,300)
8 # bbox=autocrop        : (default) - make bbox just big enough so that nothing ever get's clipped
9 #
10 # all coordinates are in pixels, not in twips. fixed point values like 1.25, 333.40 are allowed.
11 #
12 # version=6    : generate flash mx movie
13 # fps=50       : set framerate to 50 frames/second
14 # name="..."   : save result to spec.flash. (Default: input file with extension 
15 #                                          changed to .flash, or the value of the -o command line 
16 #                                          parameter if given)
17
18 # inherit swf movies:
19 # ---------------------
20
21 .swf mymovie1 "choo1.swf"
22 .swf mymovie2 filename="choo1.swf" # long form
23 .swf mymovie3 filename=choo1.swf # long form, without quotes
24 .swf mymovie4 choo1.swf # short form, without quotes
25
26 # Notice: An embedded animation can't have a different framerate than
27 # the frame rate from the surrounding animation.
28
29 #TODO: Those files currently come from the current directory- they should come from the script directory.
30
31 # load an image:
32 # --------------
33
34 .jpeg background "panorama.jpg"
35 .jpeg background2 "panorama.jpg" quality=30% #reduces jpeg quality
36
37 .png background3 "choochoo.png" #TODO
38
39 # (you can put this directly (generating a shape), or insert it into a shape via the fill= argument
40
41 # define a texture from an image:
42 # -------------------------------
43
44 .texture text1=background scale=50% rotate=45
45
46 # define a gradient
47 # -----------------
48
49 .gradient mygradient:
50     0% red
51     50% green
52     75% aquamarine
53     100% #ffffff
54 .end
55
56 # Create simple objects:
57 # ----------------------
58
59 .box mybox1 width=100 height=50 color=black fill=none #unfilled rectangle (just the lines)
60 .box mybox2 width=100 height=50 color=black           #same as above
61 .box mybox3 width=100 height=50 color=black fill      #filled black rectangle
62 .box mybox4 width=100 height=50 color=red line=2 fill=blue #blue rectangle with red edges
63 .box mybox5 width=100 height=50 color=red line=2 fill=background #part the background image, with red edges
64
65 .circle mycircle1 r=50 color=#aa33ff fill=mygradient # filled with gradient (defined above)
66
67 # Sounds:
68 # -------
69
70 .sound sound1 "LocoStart.wav"
71
72 .frame 16
73     .play sound1 loop=1 #other arguments supported: nomultiple (don't start if already playing)
74 .frame 55
75     .stop sound1
76
77 .frame 66
78     # this starts a synchronized soundtrack at this frame position. The command
79     # expects a filename, not a sound object, as it would be duplicating the
80     # sound object otherwise, and I'd rather have that done explicitly.
81     .soundtrack "LocoStart.wav" # TODO
82
83 # Sound effects on user pressing or releasing a button 
84
85 .button mybutton shape=obj1 # TODO
86 .buttonsounds mybutton press=sound1 release=sound2 enter=sound3 leave=sound4 # TODO
87
88 # Elements of the movie should be animated by various means 
89 # moving (x,y and zoom) 
90 # ---------------------
91
92 .box obj1 width=200.0 height=100.0
93
94 .frame 100
95     .put obj1 x=0 y=0 #object starts at (0,0)
96
97 .frame 140
98     .change obj1 x+=100 y=0 scale=120% # smoothly move obj1 100 pixels to the right over 40 frames,
99                                        # scaling it to 120% of it's original size
100 .frame 170
101     .jump obj1 x=200 y=200 # make object to suddenly change to 200,200 at frame 70.
102
103 .frame 190
104     .qchange obj1 x=300 y=200 # TODO # make obj1 move towards 300,200...
105 .frame 210
106     .qchange obj1 x=300 y=300 # TODO # ... and then smoothly over to 300,300 using bspline interpolation
107
108 #.frame 220   #TODO
109 #    .jump obj1 x=reset y=reset
110
111 .frame 230
112     .del obj1   #Remove object again
113
114 # morphing
115 # --------
116
117 .morphshape morphthing start="start.fig" end="end.fig" #TODO
118 .frame 250
119     .put morphthing ratio=0%
120 .frame 270
121     .change morphthing ratio=100%
122
123 # interpolation between crude manual animation frames
124 # ---------------------------------------------------
125
126 .shape ball "ball.xml" # TODO #The ball should be white or violet to make the cxforms below work
127
128 # now draw two balls, which fly around each other.
129
130 .frame 300
131 .put myball1=ball x=0 y=100 blue=0
132 .put myball2=ball x=100 y=100 red=0
133
134 .frame 310
135 # the .qchange means, "interpolate to this position and frame, using quadratic splines".
136          .qchange myball1 x=50 y=0 #TODO
137          .qchange myball2 x=50 y=100 #TODO
138
139 .frame 320
140 # We could also use coordinates relative to start position: .change myball1 x+=100 y+=0
141          .qchange myball1 x=100 y=100 #TODO
142          .qchange myball2 x=0 y=100 #TODO
143
144 .frame 330
145          .qchange myball1 x=50 y=100 #TODO
146          .qchange myball2 x=50 y=0 #TODO
147  
148 .frame 340
149 # Hmmm. This frame is the same as frame 0. How to prevent duplicating that one?
150          .qchange myball1 x=0 y=100 #TODO
151          .qchange myball2 x=100 y=100 #TODO
152
153 # color transforms (fading)
154 # -------------------------
155
156 # .put, .change, .qchange, .jump all support params which result in color transform.
157 # Everything up to the + is multiplicated, the rest summed.
158
159 .put obj1 blue=50% #(scale blue color component to 50%)
160 .change obj1 blue=128 #(same as above)
161 .change obj1 red=+25% #(shift blue color component by 25%)
162 .change obj1 red=+64 #(same as above)
163 .change obj1 green=50%+50% #(scale green color component to 50% and then shift it by 50%)
164 .change obj1 green=128+128 #(same as above)
165 .change obj1 green=-1+255 #(invert green color component)
166 .change obj1 green=2-128  #(reduce spectrum for green to the upper 50%)
167 .change obj1 luminance=50% #(fade all color components 50% to black, same as red=50% green=50% blue=50%)
168 .change obj1 alpha=50% #(make object 50% transparent)
169
170 # scaling
171 # -------
172
173 .change obj1 scale=50%   # change an object to 50% of it's size
174 .change obj1 scaley=50%  # flatten object to 50% of it's height
175 .change obj1 scaley=110% scalex=75% #(funhouse mirror!)
176
177 # rotating
178 # --------
179
180 .change obj1 rotate=45  # tilt object, counterclockwise
181
182 # shearing
183 # --------
184
185 .change obj1 shear=100%  # shear object
186
187 # sprites (a.k.a. movieClips)
188 # -------
189
190 .sprite spr1
191     .frame 1    .put ball1=ball 0 0
192     .frame 2    .change ball1 100 100
193 .end
194
195 .sprite spr2
196     .frame 1    .put ball2=ball 100 0
197     .frame 7    .change ball2 0 100
198 .end
199
200 .frame 400
201     .put spr1
202     .put spr2
203
204 # so spr1 has three frames, spr2 has seven. The whole animation loops after 21 frames.
205
206 # multi-level nesting: (sprites can be nested to any depth)
207
208 .sprite mspr1
209     .sprite mspr2
210         .sprite spr3
211         .put ball 100 0
212         .end
213     .end
214 .end
215
216 # clipping an animation inside a star-shaped sprite:
217
218 .swf mystar1 "star.swf"
219 .movie anim1 "penguins.swf"
220
221 .sprite cspr1
222     .startclip mystar1
223         .put anim1
224     .end
225 .end
226 .frame 401
227     .put cspr1 rotate=0
228 .frame 402
229     .change cspr1 rotate=360
230
231 # buttons
232 # -------
233
234 .png play "Play.png" #TODO
235 .png play_pressed "Play_pressed.png" #TODO
236 .png stoplogo "Stop.png" #TODO
237
238 .button playbutton shape=play press=play_pressed #TODO
239
240 .button playbutton2 shape=play press=play_pressed:
241     [mouse down]
242         ... actionscript ...
243 #    ...
244 .end
245
246 # button which is blue, get's green when the mouse hovers over it, and
247 # white when it is pressed:
248 .button b1 shape=blueshape over=greenshape press=whiteshape #TODO
249
250 # button where the button position is not identical to the active area:
251 .button b2 area=activearea shape=blueshape over=greenshape press=whiteshape #TODO
252
253 # (if area is not set, it's the same as shape)
254
255 # the above put into use: pop up a window if the mouse cursor enters a certain
256 # area:
257 .button b3 area=activearea shape=emptyshape over=window1 press=window1 #TODO
258
259 # button characters also support positioning and cxforming characters.
260 # to use this, we put the characters "virtually", and then use the
261 # instances in the button
262 .buttonput area1=playlogo x=300 y=400 rotate=0 #TODO
263 .buttonput shape1=playlogo x=400 y=400 rotate=0 red=50% #TODO
264 .buttonput over1=playlogo x=400 y=400 rotate=30 red=50% #TODO
265 .buttonput press1=playlogo x=500 y=500 rotate=180 #TODO
266 .button mybutton1 area=area1 shape=shape1 over=over1 press=press1: #TODO
267      #[...actionscript...]
268 .end
269
270 # fonts
271 # -----
272 .font font1 "myfont.swf"
273 .font font1 "myfont.ttf"
274 .font font1 "myfont.pfa"
275
276 # text fields
277 # -----------
278 .text mytext1 font=font1 text="I am a happy little scroll message" color=blue size=100%
279
280 # edittext
281 # --------
282 #(field where the flash animation can get input from the user)
283
284 .font helvetica "helvetica-bold.swf"
285 .edittext edittext1 text="Type something here" color=blue maxlength=200 font=helvetica size=24 width=320 height=200 #TODO
286 # width/height: dimensions of the box
287 # text: The text which appears initally in the box, and can be overwritten by the user
288 # maxlength: max. length of the text the user can type
289 # color/font/size: Font appeareance
290 # variable: Name of the actionscript variable the text is stored in
291 # The following boolean options are also supported:
292 # password (show input only as stars), wordwrap, multiline, html, noselect, readonly
293
294 # actionscript
295 # ------------
296
297 .action:
298     _root.play();
299 .end
300
301 # depth control
302 # -------------------
303 # .put, .change, .qchange, .jump, .startclip take before and after parameters,
304 # which can be used to specify the depth of an object
305
306 .put o1=obj1 #TODO
307 .put o2=obj1 below=o1 x=50 #TODO
308 .frame #TODO
309 .change o1 #TODO
310 .change o2 above=o1 x=50 #TODO
311
312 # newline conventions
313 # -------------------
314
315 # All Newlines are treated as normal whitespace. Therefore, splitting
316 # commands over several lines, like
317 .put obj2=obj1 x=300
318              y=300
319              red=100%
320              green=50%
321              blue=50%
322 # is allowed.
323
324 # Furthermore, having more than one command in one line is also possible:
325
326 .frame 600  .change obj1 x+=700  .change obj2 x+=300
327 .frame 601  .change obj1 x+=500  .change obj2 x+=500
328 .frame 602  .change obj1 x+=300  .change obj2 x+=700
329
330 .end # end of first file
331