Aego Русский

Curves in Go

type Fader struct {
  Alpha curve.Curve `aego:"alpha"`
}

c := curve.Keyed(curve.Key{T: 0, V: 1}, curve.Key{T: 0.5, V: 1, Interp: curve.InterpLinear}, curve.Key{T: 1, V: 0})
v := c.Eval(0.75)
Function
FromEasing(e), Line(t0, v0, t1, v1), Constant(v), Keyed(keys...) construction
Eval, EvalClamped, Span, Duration, Range(samples) reading
Fix, Smooth, Normalize, Bake(samples) editing helpers

Keyed and Fix sort the keys, drop keys with NaN and keep the last of two keys at the same time. Change Keys directly only together with Fix or Smooth.

In scenes and prefabs a curve is written as a struct; defaults are omitted and a preset has no keys:

falloff={ ease=outQuad post=pingPong }
alpha={ keys=[[0, 1, 0, 0, bezier, auto], [1, 0, -2, -2, linear, free]] }