DR - Fusion Expression Cheat Sheet & Examples

Text1.StyledText.Value – get Value from a text node

floor(Rectangle1.Width/1.8*100) ..” %” – display % value based on graph length

Point(Rectangle1.Width/2-0.02, 0.5) – position Text node Layout Center on the graph bar

:a=tonumber(string.sub(Text1.StyledText.Value, 0, string.len(Text1.StyledText.Value)-2)); return a – get Value from another Text node, even if the Value is made with an expression

floor(Rectangle1.Width*Text2.StyledText.Value/Text1.StyledText.Value*100)/100 – use in Rectangle node Width property. Change the width based on the main Rectangle Width, its value and the value of the current bar
iif(time<=floor(comp.RenderEnd*0.87), ceil(comp.RenderEnd/2), iif(time>ceil(comp.RenderEnd*0.86), floor(ceil(comp.RenderEnd/2)+(time-floor(comp.RenderEnd*0.86))*(floor(comp.RenderEnd/2))/(comp.RenderEnd-floor(comp.RenderEnd*0.86)))))
Dynamic transitions

Use in the Dissolve node to switch Foreground/Background:

iif(time<(comp.RenderEnd/2),1,0) – Instantly switch between the FG/BG at the midpoint of the clip duration

iif((comp.RenderEnd-time)<(comp.RenderEnd/2),0,1) – does the same as above in a different way

time/comp.RenderEnd – gradually blend and switch FG/BG


floor(1.99) – returns 1
ceil(1.01) – returns 2


time – returns the current frame
comp.RenderStart – returns the first frame
comp.RenderEnd – returns the last frame

min(num1,num2) – returns the lower of the 2 numbers max(num1,num2) – returns the larger of the 2 numbers random(num1,num2) – random number between num1 & num2
SOCIAL MEDIA BORDER TIMER 1080p, 2k, 4k, 1350p
Adjusts the rectangle starting position based on timeline resolution
:if (ratio == 1.77) then return 0.585; end; if (ratio == 0.56) then return 0.657; end; if (ratio == 0.8) then return 0.636; end; if (ratio == 1) then return 0.622; end; if (ratio == 1.89) then return 0.58; end;

Make a ratio variable inside ANY node :ratio=floor(comp:GetPrefs(“Comp.FrameFormat.Width”)/comp:GetPrefs(“Comp.FrameFormat.Height”)*100)/100;
Date & time
%a – “Mon”
%A – “Monday”
%b – “Jan”
%B – “January”
%c – date and time “01/28/87 20:50:20”
%d – day from 01 to 31
%H – 24h format
%I – 12h format
%M – minutes from 0 to 59
%m – month from 01 to 12
%p – “am” or “pm”
%S – seconds from 00 to 59
%w – weekday from 0 to 6 (Sunday-Saturday)
%x – date “01/28/87”
%X – time “20:50:20”
%Y – year “1987”
%y – year with 2 digits from 00 to 99
%% – gives you the % character

Usage example:
os.date(“%Y, %x, %b, %A”)

Custom time format (30 being FPS, and 60 seconds):

Get time in minutes and seconds (30 being FPS): os.date(“%M:%S”,(comp.RenderEnd-time)/30)
Milliseconds example
Milliseconds example with comp FPS saved in variable x: : x=comp:GetPrefs(“Comp.FrameFormat.Rate”); return x

os.date(“%M:%S”, (comp.RenderEnd-time)/x)..”:”.. string.format(“%03d”, math.fmod(comp.RenderEnd-time, x)*1000/x)
OR instead of returning the x value combine the 2 expressions:
: x=comp:GetPrefs(“Comp.FrameFormat.Rate”); return os.date(“%M:%S”, (comp.RenderEnd-time)/x)..”:”.. string.format(“%03d”, math.fmod(comp.RenderEnd-time, x)*1000/x)
Get current FPS in variable x:
: x=comp:GetPrefs(“Comp.FrameFormat.Rate”); return x

Count DOWN Timer, with 3 decimals:
string.format(“%.3f”, (comp.RenderEnd-time)/x)

Count UP Timer, with 3 decimals:
string.format(“%.3f”, (time)/x)
Shopping Cart