X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=doc%2Fswfc.xml;h=106efac95e0342750d06add1a8859b6a2328f755;hb=2689b541f1a0f9a767ac8fe55909183d2c9a7347;hp=bd1176e959ac7315e2d36ec92c75e204df72b04b;hpb=c2b431306dc202edd5c7d59cc8ddb784fe66caeb;p=swftools.git diff --git a/doc/swfc.xml b/doc/swfc.xml index bd1176e..106efac 100644 --- a/doc/swfc.xml +++ b/doc/swfc.xml @@ -45,7 +45,7 @@ Shell scripts, commands to execute: Code: (The lang= is optional) - .swf + .flash .box b1 100 100 .end @@ -103,7 +103,7 @@ Boxes:

-.swf name="box.swf" +.flash name="box.swf" .box b1 100 100 color=yellow fill=red .put b1 pin=center scale=0% .frame 100 @@ -118,14 +118,144 @@ Boxes: -
Text generation - +
Color transforms + + +.flash name="cxform.swf" version=5 + + .jpeg s1 "photo.jpeg" quality=80% + + .put s1 x=50 y=50 scalex=110 scaley=110 + .frame 100 + .change s1 x=0 y=0 scalex=210 scaley=210 red=-1+255 green=-1+255 blue=-1+255 #invert + .frame 200 + .change s1 x=100 y=50 scalex=110 scaley=110 red=0 green=+0 blue=+0 #remove red + .frame 300 + .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=2 blue=-1+255 #amplify green, invert blue + .frame 400 + .change s1 x=50 y=100 scalex=110 scaley=110 red=2-128 green=-2+255 blue=+0.7+40 #alien glow + .frame 500 + .change s1 x=0 y=0 scalex=210 scaley=210 red=8-1024 green=8-1024 blue=8-1024 #palette reduce + .frame 600 + .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=+0 blue=+0 #back to normal + .frame 700 + .change s1 x=105 y=105 scalex=0 scaley=0 luminance=0 #fadeout +.end + + +
+ + + + +Fonts + +
+ +swfc has font support. That means you can also insert texts into +your animations. +The easiest way to load a font is to do something like + + .font Arial filename="Arial.ttf" + +. +You now have a font named Arial to play with. +For example, for the obligatory hello world program: + + +.flash name="helloworld.swf" + + .font Arial filename="Arial.ttf" + .text helloworld font=Arial text="Hello World!" + .put helloworld +.end + + +Besides TrueType fonts, swfc also supports native SWF fonts. +If you have a SWF with a font you would like to use, do a + + swfextract file.swf + +Then write down the font ID of the font, and do a + + swfextract -f <fontid> file.swf -o myfont.swf + +. +

+This will give you a file named myfont.swf which you can +also use in the filename parameter of .font. +

+ +

+Furthermore, you can convert TTF and Type1 +fonts into SWF using font2swf: + + font2swf Arial.ttf -o Arial.swf + +The nice advantage of this is that you can play +Arial.swf in the flash player and see what the +font looks like. +(Also, loading a font in SWF format is slighly +faster than from a TTF file, as with TTFs spline +conversion has to take place). +

+ +
+
+

+So much for the basics. Now let's go to the more advanced +functionality. +

+ +

+Apart from being able to define text in your swfc files, +you can also define text outlines. +Those are not real characters but rather abstract vector +objects which you can use in other commands. +

+ + +.flash name="fontoutline.swf" + .font Arial "Arial.swf" + .textshape helloworld font=Arial text="Hello World" + .filled filled_helloworld outline=helloworld fill=blue line=5 color=green + .put filled_helloworld +.end + + +Here, .textshape helloworld defines an outline named "helloworld", +which is then used to construct a filled outline named filled_helloworld. + +To make this a little more interesting, let's fill with a gradient instead +of a plain color: + + +.flash name="fontgradient.swf" + .font Arial "Arial.swf" + .textshape helloworld font=Arial text="SHADE" + + .gradient whitefade: + 0% black + 50% #505050 + 100% yellow + .end + + .filled filled_helloworld outline=helloworld fill=whitefade line=1 color=#2c2c2c + .put filled_helloworld +.end + + +But let's get back to normal .text characters. +The following demonstrates that you can treat objects defined +with .text like normal shapes, i.e., scale them, move them, and use +them for clipping: + -.swf name="text5.swf" +.flash name="text5.swf" .font courier "Courier.swf" .font helvetica "Helvetica.swf" -.text hithere text="HELLO" font=courier size=50% color=blue -.shape scene Scenery50.swf +.text hithere text="HELLO" font=courier size=50% +.swf scene Scenery50.swf .frame 0 .startclip hithere pin=center x=100 y=75 scale=50% #text clips... @@ -136,9 +266,14 @@ Boxes: .end - + +Also, .text takes a color attribute (that's actually +the poor man's version of the more advanced filling options +that .textshape in conjunction with .filled offers), +which is used here together with the alpha parameter of .change: + -.swf name="text6.swf" +.flash name="text6.swf" .font courier "Courier.swf" .font helvetica "Helvetica.swf" .text hello text="HELLO" font=helvetica size=50% color=blue @@ -155,33 +290,7 @@ Boxes:
-
Color transforms + - -.swf name="cxform.swf" version=5 - - .shape s1 "photo.swf" - .put s1 x=50 y=50 scalex=110 scaley=110 - .frame 100 - .change s1 x=0 y=0 scalex=210 scaley=210 red=-1+255 green=-1+255 blue=-1+255 #invert - .frame 200 - .change s1 x=100 y=50 scalex=110 scaley=110 red=0 green=+0 blue=+0 #remove red - .frame 300 - .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=2 blue=-1+255 #amplify green, invert blue - .frame 400 - .change s1 x=50 y=100 scalex=110 scaley=110 red=2-128 green=-2+255 blue=+0.7+40 #alien glow - .frame 500 - .change s1 x=0 y=0 scalex=210 scaley=210 red=8-1024 green=8-1024 blue=8-1024 #palette reduce - .frame 600 - .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=+0 blue=+0 #back to normal - .frame 700 - .change s1 x=105 y=105 scalex=0 scaley=0 luminance=0 #fadeout -.end - - -
- - -