SCRIPTING VIDEO WITH FREEJ
With [http://freej.org FreeJ] it is also possible to generate video with the use of scripts. This is done by invoking commands on layers and effects in these scripts. Scripts can be written using javascript. Javascript is object oriented which makes it possible to handle layers and effects as objects. Every object has its own procedural commands to adapt it.
The example script
FreeJ comes with an example script to explain some basic scripting. The example script can be found in the document directory. Its location is doc/freejscripting-example.js. More information on this script can be found in the comments in the script and the file doc/freej-scripting.txt.
Running the script
While running FreeJ you can execute a script by pressing ctrl-x. FreeJ will ask for the location of the script file. By pressing enter it will start executing the given script in the current running FreeJ session. You can also start FreeJ with a script. You then have to add the -j option to the commandline:
freej -j freej_script.js
API DOCUMENTATION
just a start
(Parent) Layer methods
- set_position(int x, int y) // coords of the upper left corner
- set_blit("name") // must be an existing layer
- set_blit_val(int val)
// usually a value between 0 and 255
- rotate(double val)
// usually between 0 and 360
- zoom(double x, double y)
// floating point multiplier, 1.0 means no zoom, 2.0 means double size
- spin(double rotation, double zoom)
// the layer will start rotating and/or zooming (0 means stop)
GeometryLayer
color
geo = new GeometryLayer(640,480); add_layer(geo); // the following calls are all valid: // color takes RGBA .. // geo.color(0xff, 0xee, 0xdd, 0xff); // .. or RGB .. // geo.color(0xff, 0xee, 0xdd); // .. or the 32bit hexcode in BGRA geo.color(0xddeeffff); geo.rectangle_fill(10,10,630,470); // and you can also specify the color directly as a last argument to functions: // geo.rectangle_fill(10,10,630,470,0xddeeffff); // will work as well. run(3); quit();