synthtraffic Get started
Docs menu

Expressions

Easing

Use easing when a payload number should move from a start value to an end value over a known number of events or a known duration. These functions do not change rate, interval, or connector delay.

The result

A three-event linear ramp starts at 20, reaches the midpoint, then finishes at 80:

{"temperature":20}
{"temperature":50}
{"temperature":80}

Ramp a temperature

YAML temperature-easing.yaml
generators:
  - name: oven
    config:
      maxEvents: 3
    value:
      temperature: =easing(from=20, to=80, over=3, curve=linear, round=0)

easing(from, to, over, curve?)

Maps a number along an easings.net curve. You do not pass progress t. from, to, and over are required.

temperature: =easing(from=20, to=80, over=100, curve=easeInExpo, round=2)
temperature: =easing(from=20, to=80, over=5m, curve=easeInExpo, round=2)

The first event of either ramp is from:

{"temperature":20.00}
  • Event ramps use the generator event ordinal. The first event is from; event over is to; later events hold to.
  • Duration ramps use the time since that instance became active. They need a finite rate or interval so now() advances.
  • over must be a positive event count or a positive duration.
  • curve defaults to linear. Use a complete easings.net name such as easeInExpo. Bare names such as easeIn are invalid.
  • round=N works like other numeric functions. nullable and optional are also supported.

easingChain

A list of ramps. The call’s from is the first start value. Each later step starts at the previous to. Every over in one chain must be the same kind: all event counts or all durations. After the last step, later events hold the last to.

temperature:
  =easingChain(from=20, round=2):
    - to: 80
      over: 2m
      curve: easeInExpo
    - to: 80
      over: 2m
      curve: linear
    - to: 25
      over: 1m
      curve: easeOutCubic

With interval: 1m and six events:

{"temperature":20.00}
{"temperature":21.88}
{"temperature":80.00}
{"temperature":80.00}
{"temperature":80.00}
{"temperature":25.00}

Each chain step requires to and over. curve is optional and defaults to linear.

Use Math for one-off calculations and Delivery behavior for connector release lag. Shared modifiers such as round are listed in Modifiers.