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)

GitHub Copilot

The GTK, Windows Qt, and macOS AppKit editors can show GitHub Copilot suggestions for property expressions. Install the GitHub Copilot language server as copilot-language-server on Shrimply's PATH. Shrimply restores a saved login automatically. To sign in for the first time, open Settings โ†’ Integrations โ†’ GitHub Copilot and choose Log In. Enter the code shown in Shrimply on the GitHub page that opens.

Once signed in, use Inline Suggestions under GitHub Copilot to turn suggestions on or off while staying logged in. Shrimply remembers this setting. When suggestions are on, Shrimply shares the active expression and relevant Ebi reference text with GitHub Copilot.

Suggestions appear at the end of a line. Press Tab to accept, Esc to dismiss, or Ctrl+Shift+Space to request a suggestion.

Writing expressions

Use return when a script branches. Parentheses around conditions are optional.

if t < 1s {
    return value
} else if t < 2s {
    return value * 2
}
value * 3

Use condition ? yes : no to choose a value. Only the selected branch runs.

t < 1 ? 0 : 100

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 value and x.
  • 2D and 3D vectors expose value as a fixed-size numeric list and provide x, y, and, for 3D, z. Return a list of the same size.
  • Colors expose a Color and the channels r, g, b, and a in the range 0 to 1. Return an Ebi color, such as Rgb(r, g, b, alpha=0.5) or Hsv(120deg, 0.8, 1).
  • Booleans and text return Bool and String. For a discrete choice, return its option key as a string.

Add a vector directly to an animated position:

value + [0, sin(t * 4) * 20]

Project values and time

  • t is the clip's expression time. time and local_t are aliases. These values and duration use Ebi's exact Duration type. Number properties and arguments use their value in seconds. You can also add a duration to a number or compare it with a number of seconds.
  • fps is the effective frame rate and uses the exact Rate type. Multiplying a duration by this rate gives a frame count.
  • canvas_width and canvas_height describe the project canvas. media_width and media_height describe the source or fall back to the canvas dimensions. source_width and source_height are aliases.
  • seed is a deterministic integer for the current item and time.

frame_index(t, 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(t, 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 = t * 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.