Signals
Change the target level to see the circle zoom, the rectangle turn, and the progress meter update together.
Bindings and reactivity
letstores a value as it is now.mutcreates a value you can assign to or animate.sigderives a value that updates when its inputs change.
Element attributes keep live expressions. Use let saved = level when you need a snapshot. Signal expressions must be pure, and two animations cannot write to the same input at the same time.
Signals in functions
fn<sig> twice(sig value: Number): sig Number {
return value * 2
}
mut count = 1
sig doubled = twice(count)
let saved = doubled
count = 2
assert(doubled == 4)
assert(saved == 2)
A regular parameter receives the current value. Use sig on a parameter to keep it live and on the return type to return a live value. A signal parameter also accepts a constant. Write : sig List<Number> to return a live list.
Use reflected inputs to let people change a value in Shrimply, or curves to animate a signal through keyframes.