Skip to content
VIDEOMONTAZHERDAVINCI RESOLVE · VIDEO · AI

FUSION · Expressions

Custom controls and a controller node

Turn a long formula into clear Base, Amp and Period controls for reuse.

Fusion / DaVinci Resolve 20–21

After this lesson

  • Build a clear template interface.
  • Distinguish a control label from its internal ID.
  • Check input boundaries and dependencies.

Before you start

Composition
A separate Fusion Composition. 1920×1080, square pixels, 25 fps.
Parameter
Transform1 → Size; controller node CTRL
Range
Start at comp.RenderStart. Reference frames are local unless stated otherwise.

A good template lets you change creative parameters without editing code. Expose the base, amplitude and period as separate controls, keeping expressions inside the composition.

Create real inputs

Select a controller tool, rename it CTRL and add numeric controls through Edit Controls. Set their internal IDs to Base, Amp and Period. A label and an ID are different: expressions use the ID.

CTRL, Base, Amp and Period are not built-in Fusion names in this example. Create them yourself. Give the period a sensible range and a positive default.

Connect the dependency

Once the inputs exist, the formula reads settings from one location. Additional denominator protection keeps it evaluable when Period is zero.

SIMPLE EXPRESSION · FUSION
CTRL.Base + CTRL.Amp * math.sin(2 * math.pi * (time - comp.RenderStart) / math.max(1, CTRL.Period))

The template contract

Label the units: period in frames or seconds, amplitude in fractions or pixels. A slider limit does not replace formula validation because values may arrive through a link.

When packaging a Macro, expose only necessary settings. Test two independent title instances: changing one should not change the other unless a shared controller is intentional.

Create three inputs, not just the CTRL name

Add a separate Custom Tool and rename it CTRL. In Edit Controls, create numeric controls with IDs Base, Amp and Period; their visible labels can use any language. Set their starting values to 1, 0.1 and 60. Generate a reference to each through Pick Whip and confirm that its ID matches the formula.

Renaming a tool CTRL does not create Base, Amp or Period inputs. A quick alternative prototype uses the existing Number In controls of Custom Tool, but its formula must then reference their actual identifiers. Do not mix the two approaches in one setup.

Ranges are part of template design

For this scale exercise, set Base to 0.1–2, Amp to 0–0.5 and Period to 1–300. Interface limits help the user; math.max(1, CTRL.Period) remains a second layer inside the formula. If Amp exceeds Base, the minimum becomes negative, which may not be meaningful for scale and needs a deliberate decision.

Expose only relevant settings. Amplitude in percent differs from amplitude as a factor: percent requires division by 100. Do not substitute a technical ID for a helpful label. When saving a macro, check separately which controls are actually available to users in Edit.

Parameters and ranges

ParameterWhat it changesExample / check
BaseAverage size.Defaults to 1.
AmpSize deviation.0.1 means ±10% of unit scale, not ±10% of an arbitrary Base.
PeriodPeriod in frames, minimum 1.60 at 25 fps = 2.4 s.
CTRLController tool name.Its internal inputs must be created separately.

USE IN A COMPOSITION

Build it in Fusion

Transform1 → Size; controller node CTRL

FUSION / FLOWNodes and parameter control
100%
ImageControl in the InspectorScroll or drag the graph. Choose “Fit” to see all of it.
Solid lines are node connections in the Flow. A dashed line is a parameter dependency configured in the Inspector. A solid arrow's color matches its destination input. Modifiers are shown separately from the Flow.control.Value → Transform1.SizeText1.Output → Transform1.InputTransform1.Output → MediaOut1.InputCTRL.Base · Amp · Period → control.Base · Amp · PeriodExpression · Expression · InspectorEXPRESSIONExpressionSimple ExpressionText1 · Image node · FlowT+Text1Text+Transform1 · Image node · FlowƒTransform1TransformSizeSize · an Inspector parameter, not an image portMediaOut1 · Image node · Flow↗MediaOut1MediaOutCTRL · Control parametersCONTROLSCTRLCustom Tool
Parameter · InspectorImage
Select a node or a colored arrow

Solid lines are node connections in the Flow. A dashed line is a parameter dependency configured in the Inspector.

Connections by port and parameter4

Color is determined by the destination input. Dashed connections are configured in the Inspector; they do not add an RGBA wire to the Flow.

The controller changes control data without adding unnecessary image processing.

Assembly steps

  1. Create Custom Tool and name it CTRL. It serves as a controller; do not connect its image output into the final image branch.
  2. Open Edit Controls and add three numeric inputs with internal IDs Base, Amp and Period.
  3. Set values to 1, 0.1 and 60 with sensible ranges. Localize labels if desired, but keep the IDs as written in the formula.
  4. Create Text+→Transform→MediaOut. Enable Expression on Transform Size.
  5. Paste the formula and check CTRL references through Pick Whip.
  6. Set Amp to 0, then 0.1; change Period from 60 to 30. The size range should remain unchanged while the tempo doubles.
SIMPLE EXPRESSION · FUSION
CTRL.Base + CTRL.Amp * math.sin(2 * math.pi * (time - comp.RenderStart) / math.max(1, CTRL.Period))

Expected result. Adjust the pulse through Inspector without editing the expression.

Checkpoints

When / what to checkExpectedWhy check it
Base=1, Amp=0Constant Size=1Checks the base signal.
Base=1, Amp=0.10.9…1.1Working range.
Period=0 entered manuallyNo division by zero; period clamped to 1Checks the protective contract.
Renaming / copyingAll followers still read the intended CTRLChecks portability.

INTERACTIVE EXAMPLE

Change a parameter. Compare the result.

EXPRESSION · INTERACTIVE EXAMPLE

Set up the CTRL controller

CONTROLLED PARAMETERTransform1 → Size
0 f← → one frame at a time25 fps
VALUE GRAPH
Size
0.8811.120 f60 f120 f
Select a point on the graph to go to that frame. Values are checked throughout the range.

Base, amplitude and period are separate controls. Change them while retaining one formula that references CTRL.

OUTPUT VALUE1.1
CHECK THE ORIGINAL EXAMPLE

Base=1, Amp=0.1 and Period=60 give a range of 0.9…1.1. At Amp=0, size is constant; at Period=30, the movement is twice as fast.

Formula for the current settings +
Transform1 → Size
CTRL.Base + CTRL.Amp * math.sin(2 * math.pi * (time - comp.RenderStart) / math.max(1, CTRL.Period))

In the CTRL node's Inspector: Base = 1, Amp = 0.1, Period = 60. IDs are case-sensitive.

In Fusion, create a Custom Tool named CTRL with numeric IDs Base, Amp and Period. Their values are shown here; the browser does not create a node in Resolve.

Errors and troubleshooting

CTRL.Amp was not found

Create a custom input with that ID, not just the visible label Amp.

Both titles respond to one controller

Check reference scope after duplication and Macro export.

Independent exercise

Which three settings are enough for a user to control cyclical Angle swaying?

Show the solution and explanation

Base angle, amplitude in degrees and period with explicit units. Add phase if needed; do not expose every internal technical input.

Continue learning

Official sources

Blackmagic Design · Fusion Reference ManualThe chapter “Using Modifiers, Expressions, and Custom Controls”. Page numbers depend on the PDF edition.
Blackmagic Design · Modifiers referenceThe Modifiers section. Available commands depend on the input type and Fusion version.

An original educational walkthrough. The browser model explains the principle but does not run Fusion. Control placement depends on the version; save the original composition before replacing a parameter's control source.