>Basic usage of swfc< | Fonts | Shapes | ActionScript | Buttons | Blend Modes | Filters |
1.Basic usage of swfc
1.1 Calling swfc
swfc is command line based. You call it via
$ swfc file.sc |
Let's create simple SWF file, shall we? The following script creates a red box with a yellow border. On the right side you see the script used, on the left side the swf file that is generated.
.flash filename="box.swf" .box b1 100 100 color=yellow fill=red .put b1 pin=center scale=0% .frame 100 .change b1 pin=center scale=100% .frame 200 .change b1 pin=center scale=0% .end |
The .box command creates the box. Every object that is created must also be explicitly put into the scene using .put to become visible.
Change, on the other hand, modifies an already existing object. It works gradually: In the example above, the change happens over 100 frames. If you want to change an object suddently from one frame to the next, you would use the .jump command.
1.3 Color transforms
You can define a number of parameters in the .put, .change and .jump tags. Among those are the color transform parameters red, green, blue and alpha. Furthermore, for convenience, there's also luminance, which sets red, green and blue in one go.
Each one of these consists of two parts: The multiplicator and the shift. The syntax is ±<multiplicator>±<shift> . So, for example, to make an object 50% brighter, you would use luminance=+128. Notice that all color components inside the transformed object in the range 128-255 will be mapped to 255 with this. To map 0 to 128, 255 to 255, but 128 to 192, you would use luminance=0.5+128.
You can also specify negative values for both <mutliplicator> and <shift>. This makes it e.g. possible to invert an object: luminance=-1+255.
The following example demonstrates a few of the possible transforms:
.flash filename="cxform.swf" version=5 fps=25 .jpeg s1 "photo.jpeg" quality=80% .put s1 x=50 y=50 scalex=110 scaley=110 .frame 50 .change s1 x=0 y=0 scalex=210 scaley=210 red=-1+255 green=-1+255 blue=-1+255 #invert .frame 100 .change s1 x=100 y=50 scalex=110 scaley=110 red=0 green=+0 blue=+0 #remove red .frame 150 .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=2 blue=-1+255 #amplify green, invert blue .frame 200 .change s1 x=50 y=100 scalex=110 scaley=110 red=2-128 green=-2+255 blue=+0.7+40 #alien glow .frame 250 .change s1 x=0 y=0 scalex=210 scaley=210 red=8-1024 green=8-1024 blue=8-1024 #palette reduce .frame 300 .change s1 x=0 y=0 scalex=210 scaley=210 red=+0 green=+0 blue=+0 #back to normal .frame 350 .change s1 x=105 y=105 scalex=0 scaley=0 luminance=0 #fadeout .end |
SWFC Manual: Basic usage of swfc | Next: Fonts |