Property Expressions¶
Use the code button beside a property to drive it with Ebi.
The expression receives the property’s normal or keyframed value and runs
at the current clip time. The final expression supplies the new value.
value + sin(t)
Use return when a script branches. Parentheses around conditions are optional.
if time < 1s {
return value
} else if time < 2s {
return value * 2
}
value * 3
Property expressions support math, lists, typed functions and local variables. Scene construction, animation scheduling, resource reads, imports and signals are available when writing Ebi scenes.
Property values¶
Numbers expose
valueandx.2D and 3D vectors expose
valueas a fixed-size numeric list and providex,y, and, for 3D,z. Return a list of the same size.Colors expose a
Colorand the channelsr,g,b, andain the range 0 to 1. Return a Ebi color, such asRgb(r, g, b, alpha=0.5)orHsv(120deg, 0.8, 1).Booleans and text return
BoolandString. For a discrete choice, return its option key as a string.
Add a vector directly to an animated position:
value + [0, sin(time * 4) * 20]
Project values and time¶
time,t, andlocal_trepresent the clip’s expression time. These aliases anddurationuse Ebi’s exactDurationtype. APIs that take aNumberaccept these values in seconds. Usefloat(t)when you need to choose the numeric form explicitly.fpsis the effective frame rate and uses the exactRatetype. Multiplying a duration by this rate gives a frame count.canvas_widthandcanvas_heightdescribe the project canvas.media_widthandmedia_heightdescribe the source or fall back to the canvas dimensions.source_widthandsource_heightare aliases.seedis a deterministic integer for the current item and time.
frame_index(time, fps) returns the index of the containing frame.
timecode(frame, fps, drop_frame=false) formats a nonnegative frame as
SMPTE timecode. timecode_parts takes the same arguments and returns
hours, minutes, seconds, and frames.
timecode(frame_index(time, fps), fps, drop_frame=true)
Math and audio¶
sin, cos, and tan take a number in radians or an angle such as
45deg. lerp(a, b, progress) interpolates numbers or matching numeric
lists. Use trunc to discard the fractional part of a number.
random() gives a deterministic sample from -1 up to 1. shake()
gives smooth noise at the current time. Pass a dimensionless phase to
control its rate and separate seeds for independent motion:
let phase = time * 8
value + [shake(phase, 0), shake(phase, 1)] * 12
vol() returns the current peak amplitude of the full audio mix, from
0 to 1. vol([0, 2]) selects zero-based audio tracks. mouth() and
mouth([0, 2]) use the same selection rules. See Lip sync.
Errors¶
When an expression is empty, disabled, fails, or returns the wrong type, Shrimply uses the normal or keyframed value. Existing Rhai source stays editable and can be rewritten in Ebi using the patterns in this guide.