ScriptTrack

Paint a layer with Luau. Return one function of time and draw whatever you like into it, from a scene through its camera to pictures made by nodes.

The Courtyard Corner, granite blocks, a pine crate, a blue barrel and a steel bucket on packed sand, a red ball in the air, late afternoon sun.
Before
The same frame with a ScriptTrack, a view from high above the courtyard in the bottom left corner.
After

After: A ScriptTrack 480 by 300 pixels whose script calls RenderTo on a second Camera above the set.

A ScriptTrack is a layer of a CookVideo and a ModuleScript at once. Its source returns function(time); while the playhead is between InPoint and OutPoint, in Play mode and in renders, the function is called with the video's time and draws into the track's own image, for example with scene:RenderTo(script). A function that errors is tried again next frame, and its layer is left out until it runs cleanly. See Scripts.

Example

A layer that films the scene and fades with a trackLuau
-- a ScriptTrack in a video's Tracks folder, next to a CookTrack named Step
local video = script.Parent.Parent
local step = video.Tracks.Step

return function(time)
	script.Transparency = step:ValueAtTime(time)
	video.Scene:RenderTo(script)
end

Properties

Scripts

NameTypeDefaultDescription
DrawnFromCamerascripts onlyThe camera whose RenderTo drew this picture; a viewport showing it looks and edits through that camera.
Pathstringscripts only

Track

Offsetnumber0
any value
Places the animation of the instances in this clip; the script itself still gets video time.

Layout

ScaleVector21, 1Multiplies the drawn size around the AnchorPoint, which stays put, like After Effects.
Rotationnumber0
any value
Turns the layer around its AnchorPoint, in degrees.

Layer

BlendModechoiceNormal
Normal, Dissolve, Darken, Multiply, ColorBurn, ClassicColorBurn, LinearBurn, DarkerColor, Lighten, Screen, ColorDodge, ClassicColorDodge, Add, LighterColor, Overlay, SoftLight, HardLight, VividLight, LinearLight, PinLight, HardMix, Difference, Exclusion, Subtract, Divide, Hue, Saturation, Color, Luminosity, StencilAlpha, StencilLuma, SilhouetteAlpha, SilhouetteLuma, AlphaAdd, LuminescentPremul
Blends the layer with any Photoshop or After Effects mode; Stencil and Silhouette cut the layers below it.
MattesourceIts track matte: any image, such as another track or an AOV; a sibling track is sampled through its own transform, anything else stretches over the canvas.
MatteModechoiceNone
None, Alpha, AlphaInverted, Luma, LumaInverted

Appearance

ColorColor31, 1, 1Tints the layer with this colour.
Transparencynumber0
0 to 1
Fades the layer.
VisiblebooleantrueTurned off, hides the layer in the composite.

Animation

InAnimationchoiceNone
None, Fade, Slide, Pop, Typewriter, Wipe
How the layer animates in at its clip's In point; applied when drawn, so keys and scripts stay untouched.
InDurationnumber0.5
0 or more
How long the In animation lasts; in the Cook window, drag the inner edge of its ramp.
OutAnimationchoiceNone
None, Fade, Slide, Pop, Typewriter, Wipe
How the layer animates out at its clip's Out point; applied when drawn, so keys and scripts stay untouched.
OutDurationnumber0.5
0 or more
How long the Out animation lasts; in the Cook window, drag the inner edge of its ramp.
SlideDirectionchoiceLeft
Left, Right, Up, Down
AnimationEasingchoiceSmooth
Smooth, Linear, Back
AnimationStartnumber0
any value
AnimationEndnumber-1
any value

Layer Style

FillOpacitynumber1
0 to 1
Fades the layer's own pixels but not its layer styles, like Photoshop's Fill.
From CookLayer 6
From ModuleScript 1
From Base2D 19
From CookClip 4
From LuaSourceContainer 1
From BaseImageContent 6
From Instance 22