Constants are sort of like variables
but constants are always available and can be accessed from anywhere in
a script. Preset Variables are similar to constants since they do not need to be
defined beforehand like regular variables.
Constants are defined in the Manual, these are my additional notes:
These constants appear
The manual says this is what all static variables are initially
defined as. I've looked around for this, but never found a way to
Represents the Alpha channel, which controls transparency.
These represent color channels, or mixes of color channels. Pixel
values can be assigned or transferred by referencing these constants.
These are referred to as Boolean values. True can also be represented
1 and False as
Like most scripting languages, FXScript has a large set of pre-defined
variables that can be used in scripts.
These are image buffers,
src1 is the main clip or incoming
clip for transitions.
src2 is the outgoing clip in transitions
and doesn't do anything in generators or filters.
is the output frame, this is what will display when the filter is
These report the current alpha type of the contents of
src2. I've only used them to get the current Alpha
type when a function asks for an alpha type. This can be used intead
of the constants
Usually used in transitions, this decimal value between 0 and 1
is the current percent completion of a script. The value is equivalent
to dividing the current frame into the total duration of frames.
doesn't seem to work on slugs or color mattes, but does work on still
images. Ratio will never actually equal 1 although the last frame will be very, very close to 1. I belive that
ratio is simply
frame counts from 0 and
duration counts whole units (starting a 1)
frame will always end slightly less than
ratio will never equal 1.
Returns the current frame number. If the source is interlaced abd
tge filter does not contain a
FullFrame definition flag,
frame value on external monitors will be double that
visible in Final Cut Pro's viewer.
The first frame is counted as zero, so the last frame is always one less than the amount reported by
This counts the total number of visible frames in a specific instance of a clip. Because whole numbers start counting at 1,
duration will always return a number 1 greater than the last
frame number of a clip.
Multiplying this value by the
ratio will return the same value as
frame. One strange behavior to note is that interlaced DV returns
different numbers in Final Cut's viewer and the video monitor. FCPs
viewer is counting frames, the video ouput is counting fields (which are really half-height frames). This
can be avoided by dividing by the integer value of the aspect ratio + 0.5 (to correct for PAL). The problem does not affect non-interlaced clips or scripts that include the
FullFrame definition flag.
Returns the framerate of the clip or sequence. Since I've only been
working with DV, I only get a frame rate of 30 and I'm not sure if
that is the sequence or the project. Using
fps is preferable
of a hard-coding in a value like 30 because it makes the script more portable, allowing
it to work on NTSC or PAL or any multimedia application.
The major bummer about the
fps constant is that there
is n oFXScript command to tell if a clip is interlaced or not.
always reports 30 on NTSC video, but judging by the performance
should return 60 on external monitors from non-
scripts, to match the behavior of the other clip constants. I think this might be related to the behavior of the clip functions
These 3x3 conversion matixes were used for RGB to YUV conversions in Final Cut Pro versions prior to 1.2.5. They have been demoted in favor of the colorspace functions
This value represents the current sequence quality. It's used in
a lot of included scripts, but I haven't used it since I really never
work at anything other than the default render quality. This would be better if it described the currect zoom amount
This is used frequently with the
it is a placeholder array that allows values to pass through LevelMap
The Final Cut Pro manual wrongly states that this constant contains
values from 0 to 255.
LinearRamp actually contains 256 fractional
values between 0 and 1. This can be proven with
Joe's LinearRamp Tester, which I wrote to help visualize the
results of this and other arrays.
This can be used to separate the video monitor display from the desktop.
Anytime an FXScript shows additional information on the desktop and
not on the video output, the script probably used Previewing in an
Items can be sent only to the desktop with a statement like:
Whenever previewing is false, the results are output to both the
video monitor and the desktop.
Variables not covered:
As far as I can tell, this do not appear in the manual, however it was
used in several of the built-in scripts.
These constants are used to format the output of numbers into different
Standard format, integer are whole numbers without decimal values.
Values are not rounded to the nearest whole number, decimal values
These refer to floating point variables that aren't really floating
point variables. A floating point number simply means there is no
fixed number of digits on the right side of the decimal point, but
these formatting schemes specify a specific amount of digits shown
to the right of the decimal place. Using
is represented as 0.6667
These will format solid numbers into timecode by counting the number
of frames. So the number 100 would format as 00;00;03;10. I didn't
use these so I'm not sure how addition and subtraction would work,
but I imagine timecode values would be treated similar to whole numbers.
These are places to store common text attributes. The setting stored
here will be usd by any DrawString commands until they are reset or changed
These do just what you would expect them too. They represent the
three possible text justification methods available in Final Cut Pro.
Same as above, these represent the four possible text styles available
in Final Cut Pro.
Even though I used a keying command in Joe's
Color Glow, I didn't use any of the keying constants:
Color Space Constants
Color Space constants are discussed on the FXScript
RGB and YUV Color page.
The headache of fields vs. frames
Final Cut Pro often returns different numbers for the computer screen
and the video output. Besides being very confusing while scripting, this
results from the video monitor output counting fields while the computer
monitor counts frames. This wouldn't be much of an issue if
reported fields as well, however
fps always returns the practical
value (I always see 30 on an NTSC system). This issue is explained more
completely on the FXScript Functions
If you know of anything else that isn't mentioned on this page or can
correct any errors, please let me know: