new parameter addspacechars
[swftools.git] / doc / fileformat.sc
index 538d5d3..075538f 100644 (file)
@@ -1,3 +1,12 @@
+# ===========================================================================
+#
+# swfc(1) File format specification
+#
+# Warning: not all of this is actually implemented yet- if there's a
+# "TODO" behind a command, it has yet to be integrated into swfc.
+#
+# ===========================================================================
+
 # File header
 # -----------
 
     100% #ffffff
 .end
 
+# with a hard edge:
+
+.gradient mygradient:
+    0% red
+    50% green
+    50% red
+    75% aquamarine
+    100% #ffffff
+.end
+
+# with alpha:
+
+.gradient mygradient:
+    0%   #00000000
+    50%  #0000ff40
+    75%  #0000ff80
+    100% #0000ffc0
+.end
+
+# define a texture from a gradient:
+# ---------------------------------
+
+.texture grad2=mygradient x=0 y=0 width=125 height=200 rotate=45
+
 # Create simple objects:
 # ----------------------
 
 .box mybox2 width=100 height=50 color=black          #same as above
 .box mybox3 width=100 height=50 color=black fill      #filled black rectangle
 .box mybox4 width=100 height=50 color=red line=2 fill=blue #blue rectangle with red edges
-.box mybox5 width=100 height=50 color=red line=2 fill=background #part the background image, with red edges
+.box mybox5 width=100 height=50 color=red line=2 fill=background #filled with image "background", with red edges
 
 .circle mycircle1 r=50 color=#aa33ff fill=mygradient # filled with gradient (defined above)
+.circle mycircle1 r=50 color=#aa33ff fill=grad2      # filled with gradient texture
 
 # Sounds:
 # -------
     # sound object otherwise, and I'd rather have that done explicitly.
     .soundtrack "LocoStart.wav" # TODO
 
-# Sound effects on user pressing or releasing a button 
-
-.button mybutton shape=obj1 # TODO
-.buttonsounds mybutton press=sound1 release=sound2 enter=sound3 leave=sound4 # TODO
-
 # Elements of the movie should be animated by various means 
 # moving (x,y and zoom) 
 # ---------------------
 # morphing
 # --------
 
-.morphshape morphthing start="start.fig" end="end.fig" #TODO
+.outline shape1:
+    #define shape 1
+.end
+.outline shape2:
+    #define shape 2
+.end
+.morphshape morphthing start=shape1 end=shape2
 .frame 250
     .put morphthing ratio=0%
 .frame 270
 # interpolation between crude manual animation frames
 # ---------------------------------------------------
 
-.shape ball "ball.xml" # TODO #The ball should be white or violet to make the cxforms below work
+.circle ball r=50 color=blue fill=violet
 
 # now draw two balls, which fly around each other.
 
 # clipping an animation inside a star-shaped sprite:
 
 .swf mystar1 "star.swf"
-.movie anim1 "penguins.swf"
+.swf anim1 "penguins.swf"
 
 .sprite cspr1
     .startclip mystar1
 .png play_pressed "Play_pressed.png" #TODO
 .png stoplogo "Stop.png" #TODO
 
-.button playbutton shape=play press=play_pressed #TODO
+.button playbutton
+    .show play as=idle
+    .show play as=area
+    .show play_pressed as=pressed
+    .show play_pressed as=hover
+.end
 
-.button playbutton2 shape=play press=play_pressed:
-    [mouse down]
-       ... actionscript ...
-#    ...
+.button playbutton2
+    .show play as=idle
+    .on_press inside
+    .on_release inside
+    .on_release outside
+    .on_move_in pressed
+    .on_move_out pressed
+    .on_move_in
+    .on_move_out
+    .on_key "a":
+       # actionscript...
+    .end
 .end
 
+.button mybutton
+    .show play as=idle
+    .show obj1 x=300 y=400 scale=110% pivot=center 
+         as=pressed
+.end
+
+.box blueshape 10 10
+.box greenshape 10 10
+.box whiteshape 10 10
+.box activearea 10 10
+.box emtpyshape 10 10
+.box window1 10 10
 # button which is blue, get's green when the mouse hovers over it, and
 # white when it is pressed:
-.button b1 shape=blueshape over=greenshape press=whiteshape #TODO
+.button b1
+    .show blueshape as=idle
+    .show greenshape as=hower
+    .show whiteshape as=press
+.end
 
 # button where the button position is not identical to the active area:
-.button b2 area=activearea shape=blueshape over=greenshape press=whiteshape #TODO
+.button b2
+    .show activearea as=area
+    .show blueshape as=idle
+    .show greenshape as=hower
+    .show whiteshape as=press
+.end
 
 # (if area is not set, it's the same as shape)
 
 # the above put into use: pop up a window if the mouse cursor enters a certain
 # area:
-.button b3 area=activearea shape=emptyshape over=window1 press=window1 #TODO
-
-# button characters also support positioning and cxforming characters.
-# to use this, we put the characters "virtually", and then use the
-# instances in the button
-.buttonput area1=playlogo x=300 y=400 rotate=0 #TODO
-.buttonput shape1=playlogo x=400 y=400 rotate=0 red=50% #TODO
-.buttonput over1=playlogo x=400 y=400 rotate=30 red=50% #TODO
-.buttonput press1=playlogo x=500 y=500 rotate=180 #TODO
-.button mybutton1 area=area1 shape=shape1 over=over1 press=press1: #TODO
-     #[...actionscript...]
+.button b3
+    .show activearea as=area
+    .show emtpyshape as=idle
+    .show window1 as=hower
 .end
 
 # fonts
 
 .put o1=obj1 #TODO
 .put o2=obj1 below=o1 x=50 #TODO
-.frame #TODO
+.frame
 .change o1 #TODO
 .change o2 above=o1 x=50 #TODO