$(sine)
$(sine <seconds> [min] [max] [offset])
Gives a number that glides smoothly back and forth between min and max, completing one full cycle every seconds. Without min and max it moves between -1 and 1.
On overlays the value updates every frame, so anything you drive with it moves smoothly. Use it on any widget property that takes a dynamic value (the </> toggle), including a widget's position, size and scale. In chat bot messages and Flows it gives the value at that moment.
Every $(sine) with the same seconds moves in step, even across different overlays and browser sources.
Options
| Option | Effect |
|---|---|
seconds | How long one full cycle takes. Required |
min | The lowest value. Default -1 |
max | The highest value. Default 1 |
offset | Shifts the wave by a fraction of a cycle: 0.25 is a quarter cycle ahead, 0.5 moves opposite. Default 0 |
Examples
| Expression | Use |
|---|---|
$(sine 4 -15 15) | On a Transform widget's Rotate: sways 15° each way, every 4 seconds |
$(sine 3 100 120) | On a widget's Y position: bobs up and down by 20 pixels |
$(sine 10 0 360) | On a Hue Shift filter's Angle: shifts the colours around and back |
A ripple across several widgets
Give each widget the same wave with a growing offset:
$(sine 2 100 120 0)
$(sine 2 100 120 0.1)
$(sine 2 100 120 0.2)
On the Y position of three widgets in a row, they ripple like a wave.
With other functions
$(sine) can go inside other functions, like any value:
| Expression | Output |
|---|---|
$(round $(sine 4 0 100)) | Whole numbers from 0 to 100 |
$(math '$(sine 4) * 15 + 30') | Moves between 15 and 45 |